How do I deploy a .NET Core application on a Managed VPS?
Deploying a .NET Core application through the Application Manager is quick and easy. Before you start, you’ll need to make sure your .NET Core application files are located on the Managed VPS accessible through a directory with file permissions of 755.
Note: Ensure .Net Core is installed on the Managed VPS through the one-click installer.
Then create your application using the Application Manager which is accessible through any hosting package on your Managed VPS via Manage Hosting > Options > Manage > Application Manager.
You’ll need to create a new application to point to your .NET Core files.
- Select Create new application
- Give your application a name. This can be anything and is just for reference/display purposes.
- Select .NET Core as the Application Type
- Select the domain you’d like the application to be accessible on
- Enter the path to your application's source code directory, relative to the home directory of the package
- Enter the primary script file, for .NET Core this could be Program.cs, but may differ based on your own application. This may also be your application name, so something like ApplicationName. This really depends on how your application is set up as to which file/directory will be your primary script.
Note: If your application is configured as a reverse proxy your startup script maybe your RProxy.dll file.
- You'll need to make sure you’ve added the following code to your Program.cs file for your application to work on the Managed VPS:
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder
.UseKestrel(options => { options.ListenUnixSocket(args[0]); })
.UseStartup
});
- Development and Production modes won’t have any impact for a .NET Core application, so you can leave this option set to Development mode.
- Select Create App.
Note: Development mode will usually send any application errors to the browser, whereas Production mode will suppress browser console errors and only log exceptions through the server error logs. This does not apply to .NET Core applications.
Your application should now be running on the domain name you’ve chosen in the application manager.