.Net Core applications do not run in the same way as a standard framework one. They run inside their own web browser (Kestrel) and IIS is used as a front-end to provide security i.e. Windows Authentication, and to allow port mapping. Each .net core application runs on it’s own port and without IIS the url would need to include this port e.g.
This is unpleasant and will not get you many visitors.
Install .net Core Runtime on Server
Download and install the latest .net core run-time if it hasn’t already been installed on the server. It can be downloaded from https://dotnet.microsoft.com/download. Reboot the server to ensure it has been installed properly.
To test it has installed correctly open an admin command prompt and type:
This will display all the installed run-times. If it doesn’t then it isn’t installed.
Publish the project as normal in Visual Studio. Either publish to the wwwroot folder in IIS or publish locally and copy it over manually afterwards.
Open IIS Manager and create a new application pool and set it to “No Managed Code” as this application is not using the .net framework.
Right-click on the site’s folder in IIS manager and “convert to application”. Set up as normal making sure you select the new application pool for it to run under.
Browse to the website and see if it works!
It Didn’t Work!
If it doesn’t work check the Windows Event Log for any clues. If there is nothing useful there you can turn on the framework’s debugging log by editing the web.config. This web.config is created during the publishing process not in your project. Set “stdoutLogEnabled” to true in the file and create a logs folder which IIS_USERS can write to.
<aspNetCore processPath="dotnet" arguments=".\AddressLookupWebService.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
Don’t forget to disable this once you have fixed the problem. Especially as if you use the default location the log files could be downloaded by a 3rd party.
Updating a Website
Unlike a normal .net framework app, a .NET Core one runs in situ. This means it cannot be updated if it is in use as the files cannot be overwritten. The best way to overcome this is to add an app_offline.htm file to the folder. This will close all connections and display a nice message while the site is updated. Alternatively the application pool can be stopped which will force all users off the system.