Hosting on IIS
An ASP.NET Core application shouldn't be directly exposed to the internet, even if it's supported for even Kestrel or HTTP.sys
. It would be best to have something like a reverse proxy in between, or at least a service that watches the hosting process. For ASP.NET Core, IIS isn't just a reverse proxy. It also takes care of the hosting process, in case it breaks because of an error. If that happens, IIS will restart the process. NGINX may be used as a reverse proxy on Linux that also takes care of the hosting process.
To host an ASP.NET Core web on IIS or on Azure, you need to publish it first. Publishing doesn't only compile the project; it also prepares the project for hosting on IIS, on Azure, or on a web server on Linux, such as NGINX.
The following command will publish the project:
dotnet publish -o ..\published -r win-x64
When viewed in a system browser, this should look as follows:
Figure 12.3 – A .NET...