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

logo_NETcore

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.

We always support the latest versions of the .NET SDK and framework.


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

NodeChef will call your app with the parameter --server.urls. NodeChef also automatically exports the environment variable ASPNETCORE_URLS with the endpoint assigned to your app. You should not hardcode the server url in your code. You could also reference the environment variables PORT and use the IP address "0.0.0.0" if you need to sort of support a conditional dev and productin environment.

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(); }