Windows + IIS Environment deploys ASP. NET Core App

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

Environment: Windows Server, IIS 8, ASP. NET Core 1.1.

Many people who deploy the ASP. NET Core app for the first time in IIS encounter problems and find that the original deployment method cannot run the ASP. In the past, either the original ASP program or the later ASP, the deployment in IIS has not changed much, just point to the program directory, then set the virtual directory, and finally do some parameter configuration. In order to cross-platform and bring in a lightweight web Server-kestrel, the ASP. NET Core app in IIS requires a new mechanism to coordinate IIS with Kestrel Data transfer between servers.

1. The deployment model for ASP.

Unlike the traditional ASP. ASP. NET Core app uses the Kestrel Server. Kestrel is a cross-platform web Server that, like IIS, is responsible for the listening, receiving, and responding of requests, but without IIS's rich management capabilities, IIS is still required to handle some of the predecessor work. (You can also use Apache for pre-processing, of course)

IIS is responsible for forwarding external requests to the back-end ASP. NET Core App, acting as a "reverse proxy (Reverse-proxy)" role.

2. Understanding Reverse Proxies

"Reverse" refers to the inbound direction, "agent" can be understood as a service, this is the forwarding HTTP request service. A "reverse proxy" is the service that forwards HTTP requests in the inbound direction.

As with routers, routers, in addition to allowing the LAN to access the Internet, can also access one of the internal servers from the Internet by setting up NAT or port mapping, which is equivalent to forwarding the inbound request to the specified computer, similar to the reverse proxy role of IIS. The proxy server and the router both play the role of data forwarding, but the proxy server forwards the data of some kind of application, and the router forwards the packet.

3. Deployment Environment

The ASP. NET Core App deployment requires the operating system to meet:

    • Windows 7 or later
    • Windows Server R2 or later
4. Configure IIS

On Windows Server, you install and configure IIS through "Add roles and Features" on desktop windows through "Enable and disable Windows features." Make sure that the Web service and the IIS Management console are checked:

Windows Server IIS Installation configuration

Desktop Windows IIS installation configuration

5. Install the. NET Core Windows Server Hosting Assembly

Installs the. NET Core Windows Server Hosting assembly, which enables IIS to have reverse proxy functionality. The assembly contains the. NET Core runtime (runtime), the. NET Core class library, and the ASP. where the ASP. NET Core module is responsible for reverse proxy work. Note that if you are installing offline, you must first manually install Microsoft Visual C + + redistributable.

In particular, please download the latest version of. NET core Windows server Hosting to ensure that the. NET core version on the server is not less than the version of the ASP.

Download the latest version of. NET Core Windows Server Hosting

Installation is complete, restart the system, or restart the IIS service.

6. Configuring the ASP. NET Core App in IIS

The next steps are basically the same as deploying a traditional site, but there are a few differences, please note.

1) Create a directory in the server to store the post-release app files to ensure that the app's Web. config file is in the root directory of the Web site.

2) Create a logs folder at the site root. If you turn on some log services, log files will be recorded here. Of course, you can also not log, but initial deployment is helpful for troubleshooting, it is recommended to create.

3) Add the Web site in IIS Manager. The steps are consistent with the general site configuration:

4) Configure the application pool. In the left navigation bar, select Application pool, select the specified program pool, right-click menu, select Basic Settings, and set the. Net CLR version to unmanaged code.

7. Test the ASP. NET Core App

This example uses a test public domain name www.test.com, obviously we do not have permission to change this domain name in the public network parsing record, but we can change this domain name in the local point for testing. Use Notepad to open the C:\Windows\System32\Drivers\etc\hosts file and add a record of "127.0.0.1 www.test.com". After we access the domain name www.test.com locally, the IP address resolves to 127.0.0.1. Using the browser to open www.test.com, we will see that the ASP. NET Core app is working:

Windows + IIS Environment deploys ASP. NET Core App

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.