Use the iis reverse proxy. net core application, iiscore
. Net core is actually a self-hosted web application, instead of a web site. Therefore,. net core can be directly deployed as a system service. However, in practice, to support multiple web applications and unified management for the same port, it is still necessary to integrate with a server, such as iis and Jexus. Therefore,. net core is no longer hosted by iis workers, but is managed by a self-hosted Web server (Kestrel ). Iis acts as a reverse proxy to forward requests to Kestrel. The most important role here is AspNetCoreModule, which is one of the IIS modules. After a request enters IIS, it is immediately forwarded and quickly redirected to ASP. in the. NET Core project, we do not need to set an application pool to host our code at this time. It is only responsible for forwarding requests.
Before deployment, make sure that your IIS has the AspNetCoreModule hosting module installed. If not, click https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/aspnet-core-module? Tabs = aspnetcore2x select the corresponding package for download and installation based on the core version.
Publishing programs and deploying websites are no different from traditional websites.
Set the. net clr version of the application pool to "unmanaged code", because as mentioned earlier, IIS acts as a reverse proxy and does not need to host code.
(PS pictures borrow garden Friends pictures and invade and delete them)
Finally, you need to add environment variables to the web. config file.
<EnvironmentVariables> <environmentVariable name = "ASPNETCORE_ENVIRONMENT" value = "Development"/> </environmentVariables>
For more information, see the official document https://docs.microsoft.com/en-us/aspnet/core/publishing/iis