Summary
In recent projects, attempts to use ASP. NET core development, when deployed, consider the existing hardware, can only be deployed on Windows, Linux server is temporarily not.
Deployment considerations
IIS and Kestrel are enabled in the code
Public class program { publicstaticvoid Main (string[] args) { buildwebhost (args). Run (); } Public Static Iwebhost buildwebhost (string[] args) = webhost.createdefaultbuilder (args) . Usekestrel () . Usecontentroot (Directory.GetCurrentDirectory ()) . Useiisintegration () . Usestartup<Startup>() . Useapplicationinsights () . Build (); }
Installing on the service side
. NET Core Windows Server managed Bundles
Bundles can install the. NET core runtime,. NET core libraries, and ASP. This module creates a reverse proxy between IIS and the Kestrel server. If your system does not have an Internet connection, first obtain and install Microsoft Visual C + + redistributable, and then install the. NET Core Windows Server managed bundle.
Restart the system, or execute the net stop was/y and net start w3svc from the command prompt. restarting IIS selects the Setup program's changes to the system PATH.
Release
Use vs Publish or use command, here because of the use of vs2017 development, directly with VS published
Create a new site on the server
Modify the application pool CLR to no Managed Code
You can create a new subweb below test
Confirm that the process model identity has the appropriate permissions.
If you change the default identity of the application pool (Process model > Identity) from applicationpoolidentity to another identity, verify that the new identity has the required permissions to access the app's folders, databases, and other required resources. For example, the application pool requires read and write permissions to the folder so that the application can read and write files to it.
Common errors
If the IP and port access, reported 500 error, but on the server through dotnet \xxxxx.dll can start kestrel, and can be accessed through http:\\localhost:5000, can generally be resolved by modifying the Site Directory permissions. At least permission to read and write.
Other errors, refer to
Https://docs.microsoft.com/zh-cn/aspnet/core/host-and-deploy/iis/troubleshoot
ASP. NET core is hosted on Windows using IIS