This article is a mirror article of machine translation, please click here to jump to the original article.

View: 34039|Reply: 2

[.NET Core] Deploy ASP.NET Core to IIS server

[Copy link]
Posted on 7/24/2019 12:45:08 PM | | | |
Environment:

WIN 10 x64 system IIS 10 version
.net core 2.2
Host ASP.NET Core on Windows with IIS on supported operating systems: Windows 7 or later, Windows Server 2008 R2 or later.

First, create a default asp.net core website example with VS, findStartup.csThe documents are as follows:

Original code:

Add the IIS service code to ConfigureServices(IServiceCollection services) and modify it to:

ForwardClientCertificate setting

  • If ForwardClientCertificate is set to false, the reverse proxy does not request the client certificate during the SSL handshake between the reverse proxy and the client. This is the default behavior.
  • If ForwardClientCertificate is set to true, the reverse proxy requests the client's certificate during the reverse proxy's SSL handshake with the client. The client certificate data in a custom HTTP header named X-Client-Certificate is then forwarded. The header value is the base64-encoded PEM format string of the client certificate. After checking the certificate data, the service may succeed/fail to process the request and return the corresponding status code. If the client does not provide a certificate, the reverse proxy forwards the empty header and lets the service handle the situation.



Right-click on the project publishing website, the file method I use:



Open IIS Manager, create a new site, and set up the . NET CLR version is "unmanaged code" because IIS acts as a reverse proxy and does not need it to host code.

Copy the file /bin/Release/netcoreapp2.2/publish/ under the project directory to the root directory of the newly created site folder.

Try accessingThe hyperlink login is visible.The error is as follows:

HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the relevant configuration data for that page is invalid.



Solution:

Installation environment: Microsoft Visual C++ 2015 Redistributable and .NET Core Hosting Bundle. (Note: Get and install Microsoft Visual C++ 2015 Redistributable before installing the .NET Core hosting bundle.) )

Download link for Microsoft Visual C++ 2015 Redistributable Update 3
The hyperlink login is visible.

dotnet-hosting-2.2.6-win download link
The hyperlink login is visible.



The .NET Core Runtime & Hosting Bundle contains everything you need to run your existing .NET Core applications, including hosting ASP.NET Core applications. The package includes. NET Core runtime, ASP.NET Core runtime, it will also add ASP.NET core IIS modules if installed on a computer with IIS.

Trying to access the website again, the interface content is successfully displayed as follows:


(End)





Previous:Spring Hibernate looks at the SQL statements that are generated and executed
Next:Franklin's 13 Laws of Self-Discipline
Posted on 7/27/2019 10:02:31 PM |
The <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel> in the xxxcsproj file is changed to < AspNetCoreHostingModel > OutOfProcess </ AspNetCoreHostingModel > because it is not hosted by iis
Posted on 7/29/2019 1:39:32 PM |
Summer Posted on 2019-7-27 22:02
The InProcess in the xxxcsproj file is changed to < AspNetCoreHostingModel > OutOfProcess because it is not hosted by iis, so it is a process...

If the above modifications are not made, HTTP Error 500.30 is reported
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com