ASP中有breaking changes个.NET 5 RC2发布:

  • 它被重新命名为ASP.净核心1.0(ASP.NET 5 is dead)
  • 再见dnvmdnu命令行,它们被dotnet取代
  • 各种必要的代码更改

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

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

web.config中提到了这些环境变量,它取自official rc1-to-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>

%LAUNCHER_PATH%%LAUNCHER_ARGS%的正确值是什么?这些值在它们的github publish document中没有提及.

推荐答案

从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.configsrc\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\wwwrootC:\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.

Asp.net相关问答推荐

ASP.NET控制器上的默认接受媒体类型

为什么 @Html.EditorFor 和 @Html.PasswordFor 在 MVC 中创建不同的样式框?

web.config 部分的单独配置文件

从数据库中检索数据的最快方法

某些黑客能否从用户那里窃取 Web 浏览器 cookie 并在网站上使用该名称登录?

测试项目中的 App.config

将 null 转换为字符串的函数

异步编程与线程有什么不同?

如何使用三个按钮是否和取消显示确认alert ,如 MS Word 中所示

返回值使用 String result=Command.ExecuteScalar() 结果返回 null 时发生错误

.NET 核心 IdentityUser 模型中规范化邮箱和用户名的用途是什么?

使用 JavaScript 禁用 ASP.NET 验证器

排序下拉列表? - C#,ASP.NET

尽管安装了 AspNetCoreModule,但在 IIS 中运行 ASP.NET Core 应用程序时出现 0x8007000d 错误 500.19

带有完整内存错误的 WCF 服务(内存门判断失败,因为可用内存) - 如何解决

如何在 ASP.NET 中获取原始请求正文?

使用 .NET 连接到 AS400

当用户在文本框中按 Enter 键时执行按钮单击事件

判断 IQueryable 结果集的最佳方法是什么?

RegisterStartupScript 不适用于 ScriptManager、Updatepanel.这是为什么?