asp.net core托管在IIS里
承載在IIS里的步驟
1、安裝iis里的aspnet core 模塊(簡(jiǎn)寫ANCM)(asp.net core module)
可以通過(guò)安裝 DotNetCore.2.0.0-WindowsHosting.exe來(lái)安裝模塊
2、配置web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--開(kāi)發(fā)環(huán)境配置,發(fā)布后會(huì)將%LAUNCHER_PATH%替換成dotnet,%LAUNCHER_ARGS%替換成.\\AspNetCore.dll-->
<system.webServer>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\\logs\\stdout" forwardWindowsAuthToken="false" />
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
</system.webServer>
</configuration>
3、發(fā)布網(wǎng)站,并在iis新建網(wǎng)站指向已經(jīng)發(fā)布的網(wǎng)站路
說(shuō)明:iis的路徑必須是網(wǎng)站發(fā)布后的路徑,不能是release/bug里的路徑(路徑下缺少必要的dll)
發(fā)布后的網(wǎng)站,web.config里的配置已經(jīng)變成如下
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\\AspNetCore.dll" stdoutLogEnabled="false" stdoutLogFile=".\\logs\\stdout" forwardWindowsAuthToken="false" />
</system.webServer>