从github IISSample(感谢@Pawel and 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"/>
和他们打了几个小时交道后,我发现有two个网站.我们需要处理的配置: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迁移,请将http绑定目录也迁移到项目根文件夹,而不是wwwroot.例:从C:\inetpub\ProjectName\wwwroot
到C:\inetpub\ProjectName
.
要进行自动替换,请将此代码段添加到项目中.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工具段将这些启动器变量转换为适当的部署值.如果没有它,您将收到以下错误:
No executable found matching command "dotnet-publish-iis"
我正在使用RC2工具包预览版1.