.Net Core:部署IIS


 

1、環境安裝

https://dotnet.microsoft.com/download/dotnet-core

下載Runtime & Hosting Bundle包安裝,iis模塊會出現支持netcore的內容

 

2、部署iis

和原來的net部署一樣,唯一區別是將托管模式修改為無托管

 

另外可配置web.config,方便輸出站點日志

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\API.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
    </system.webServer>
  </location>
</configuration>

 

 

 

擴展:

.netcore的托管模式主要分2種:進程內托管和進程外托管

在 IIS 工作進程 (w3wp.exe) 內托管 ASP.NET Core 應用,稱為進程內托管模型
將 Web 請求轉發到運行 Kestrel 服務器的后端 ASP.NET Core 應用,稱為進程外托管模型

 

通過修改項目文件配置如下,修改為進程內托管,默認沒有或者設置為OutOfProcess為進程外托管模式

<PropertyGroup>
  <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup>

 

https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/aspnet-core-module?view=aspnetcore-2.2

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM