ASP. NET core is hosted on Windows using IIS

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.