来自 github IISSample(谢谢@Pawel 和 Luke),这里是价值可能性:
<!-- This set of attributes are used for launching the sample using IISExpress via Visual Studio tooling -->
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
<!-- This set of attributes are used for launching the sample for full CLR (net451) without Visual Studio tooling -->
<aspNetCore processPath=".\IISSample.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
<!-- This set of attributes are used for launching the sample for Core CLR (netcoreapp1.0) without Visual Studio tooling -->
<aspNetCore processPath="dotnet" arguments=".\IISSample.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
经过几个小时的处理,我发现有两个我们需要处理的 web.config:src\ProjectName\wwwroot\web.config 和 src\ProjectName\web.config。如果你没有后者,VS2015 publish 会默认为你生成一个%LAUNCHER_PATH% 和%LAUNCHER_ARGS%。
要让项目在 VS2015 下通过 IISExpress 在本地运行和调试,web.config 都需要具有以下默认值。将 LAUNCHER_PATH 和 LAUNCHER_ARGS 替换为其他内容会导致 VS2015 无限期挂起。
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
但是,在部署到 IIS 时(我在 WinServer 2012 R2 上使用 8.5),src\ProjectName\web.config 上的值必须替换为以下内容。如果已配置,dotnet publish-iis 命令会为您进行替换(见下文)。
<aspNetCore processPath="dotnet" arguments=".\ProjectName.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
如果您从 RC1 迁移,change http 绑定目录以及项目根文件夹,而不是 wwwroot。示例:从C:\inetpub\ProjectName\wwwroot 到C:\inetpub\ProjectName。
给configurepublish-iis做自动替换,把这个sn-p添加到你的project.json中:(谢谢@Pawel)
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview1-final"
}
},
"scripts": {
"postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
}
IISIntegration 工具段将这些 Launcher 变量转换为适当的部署值。没有它,你会得到以下错误:
No executable found matching command "dotnet-publish-iis"
我正在使用 RC2 Toolkit Preview 1。