Asp.net core manages IIS on windows for detailed steps, coreiis

Source: Internet
Author: User
Tags net core windows server hosting server hosting

Asp.net core manages IIS on windows for detailed steps, coreiis

Summary

In a recent project, I tried to use asp.net core for development. During deployment, considering the existing hardware, it can only be deployed on windows, but not on linux servers. I won't talk much about it below. Let's take a look at the detailed introduction.

Precautions for deployment

Enable iis and Kestrel in code

public class Program {  public static void Main(string[] args)  {   BuildWebHost(args).Run();  }  public static IWebHost BuildWebHost(string[] args) =>   WebHost.CreateDefaultBuilder(args)   .UseKestrel()      .UseContentRoot(Directory.GetCurrentDirectory())   .UseIISIntegration()   .UseStartup<Startup>()   .UseApplicationInsights()   .Build(); }

Install on the server

. NET Core Windows Server hosting bundle

The. NET Core runtime,. NET Core library, and ASP. NET Core module can be installed in the bundle. This module creates a reverse proxy between IIS and the Kestrel server. If the system does not have an Internet connection, first obtain and install Microsoft Visual C ++ 2015 Redistributable, and then install the. NET Core Windows Server hosting bundle.

Restart the system, or execute net stop was/y and net start w3svc from the command prompt. Restart IIS to select the system PATH changes made by the installer.

Release

Use vs to publish or use commands. Because vs2017 is used for development, vs is directly released.

Create a site on the server

Modify the application pool CLR to No Managed Code

You can create a sub-site test

Make sure that the process model identity has the appropriate permissions.

If you change the default ID ("Process Model"> "ID") of the application pool from ApplicationPoolIdentity to another ID, verify that the new ID has the required permissions, you can access Application folders, databases, and other required resources. For example, the application pool requires the read and write permissions on folders so that the application can read and write files.

Common Errors

If you access through an ip address or port, Error 500 is reported, but dotnet \ xxxxx is used on the server. dll can start kestrel and can be accessed through http: \ localhost: 5000. Generally, you can modify the site directory permission to solve the problem. At least read and write permissions.

For other errors, see

Https://docs.microsoft.com/zh-cn/aspnet/core/host-and-deploy/iis/troubleshoot

Summary

The above is all the content of this article. I hope the content of this article has some reference and learning value for everyone's learning or work. If you have any questions, please leave a message to us, thank you for your support.

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.