Working with .NET, ASP.NET Core hosting on NodeChef


NodeChef .NET Core hosting is based on managed docker containers in a production grade environment with integrated support for MySQL, MongoDB, PostgreSQL and Redis.

NodeChef takes care of the hard stuff like running your .NET containers in production, scaling, elastic loading, builds using the open source Cloud foundry buildpack and many other production ops.

This section provides details into what is supported and simple tutorials on working with .NET Core hosting in a production environment.

Deploying your project folder

The platform supports .NET core application when one of the below conditions are met

To deploy a .NET Core application, simply zip your project folder or the output directory of the dotnet publish command and upload it from the dashboard or you can also use the CLI by running the below command:

nc deploy -i hello-world-asp-net -bp dotnet

You must replace hello-world-asp-net with the name of the app you created on the NodeChef dashboard.

Listening for incomming connections on the PORT variable

Your app must use the environment variable PORT to listen for incomming connections, the below sample Main function works on NodeChef. The buildpack automatically passes the PORT variable as an argument to the dotnet run command

public static void Main(string[] args) { var config = new ConfigurationBuilder() .AddCommandLine(args) .Build(); var host = new WebHostBuilder() .UseKestrel() .UseConfiguration(config) .UseContentRoot(Directory.GetCurrentDirectory()) .UseStartup<Startup>() .Build(); host.Run(); }

Specify a .NET Framework Version to install in the Ubuntu Container