来自githubIIS样本 https://github.com/aspnet/IISIntegration/blob/dev/samples/IISSample/web.config(谢谢@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"/>
经过几个小时的处理,我发现有two我们需要处理的 web.configs:src\ProjectName\wwwroot\web.config
and src\ProjectName\web.config
。如果你没有后者,VS2015 发布将为你生成一个%LAUNCHER_PATH%
and %LAUNCHER_ARGS%
默认情况下。
要让项目通过 IISExpress 在 VS2015 下本地运行和调试,两个 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 https://github.com/aspnet/Announcements/issues/173http 绑定目录以及项目根文件夹,而不是 wwwroot。示例:来自C:\inetpub\ProjectName\wwwroot
to C:\inetpub\ProjectName
.
To 配置 https://github.com/aspnet/cli-samples/blob/master/HelloMvcApi/project.json#L21-L29 publish-iis
要进行自动替换,请将此代码段添加到您的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。