ASP.Net Core 1.0 RC2:web.config中提到的LAUNCHER_PATH和LAUNCHER_ARGS是什么?

Jes*_*aya 40 asp.net asp.net-core

ASP.NET 5 RC2版本中有重大变化:

  • 它被重新命名为ASP.NET Core 1.0(ASP.NET 5已经死了)
  • 再见dnvmdnu命令行,它们被替换为dotnet
  • 各种必要的代码更改

我正在尝试部署生成的文件dotnet publish.文件结构与RC1不同.我在事件查看器中看到以下错误:

Failed to start process with commandline '%LAUNCHER_PATH% %LAUNCHER_ARGS%', Error Code = '0x80070002'.

提到了这些环境变量web.config,它取自官方的rc1到rc2文档.

<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*"
              modules="AspNetCoreModule" resourceType="Unspecified"/>
    </handlers>
    <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%"
        stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout"
        forwardWindowsAuthToken="false"/>
  </system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

什么是正确的价值观%LAUNCHER_PATH%%LAUNCHER_ARGS%?这些值在其github发布文档中未提及.

Jes*_*aya 52

从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"/>
Run Code Online (Sandbox Code Playgroud)

经过几个小时处理它们后,我发现有两个 web.config需要处理:src\ProjectName\wwwroot\web.configsrc\ProjectName\web.config.如果你没有后者,VS2015发布将会为您生成一个与%LAUNCHER_PATH%%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"/>
Run Code Online (Sandbox Code Playgroud)

但是,在部署到IIS(我在WinServer 2012 R2上使用8.5)时,src\ProjectName\web.config必须使用以下内容替换值on .如果已配置,该dotnet publish-iis命令将为您进行替换(参见下文).

<aspNetCore processPath="dotnet" arguments=".\ProjectName.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
Run Code Online (Sandbox Code Playgroud)

如果要从RC1迁移,请将http绑定目录更改为Project根文件夹,而不是wwwroot.示例:从C:\inetpub\ProjectName\wwwrootC:\inetpub\ProjectName.

配置 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%"
  }
Run Code Online (Sandbox Code Playgroud)

IISIntegration工具段将这些Launcher变量转换为适当的部署值.没有它,您将收到以下错误:

No executable found matching command "dotnet-publish-iis"
Run Code Online (Sandbox Code Playgroud)

我正在使用RC2 Toolkit Preview 1.

  • 我不认为RC2需要2个web.config.我相信wwwroot中的那个现在没用了. (2认同)

小智 9

这是VS中web.config的一部分:

<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%"
    stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout"
    forwardWindowsAuthToken="false"/>
Run Code Online (Sandbox Code Playgroud)

这是在发布后在服务器上:

<aspNetCore processPath="dotnet" arguments=".\AppName.dll" 
    stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" 
    forwardWindowsAuthToken="false" />
Run Code Online (Sandbox Code Playgroud)

在这个例子中%LAUNCHER_PATH%,通过置换dotnet,并%LAUNCHER_ARGS%通过application name.dll扩展


Paw*_*wel 8

%LAUNCHER_PATH%%LAUNCHER_ARGS%由相对于使用 publish-iis工具(如果已配置)将在您发布应用程序时覆盖它们.