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相关问答推荐

更新剃须刀页面中图表的值

如何正确配置 IHttpModule?

如何从 JavaScript 调用 C# 函数?

log4net 记录所有未处理的应用程序错误

如何在运行时判断动态数据类型的类型?

C# ASP.NET Core Serilog 添加类名和方法到日志(log)

如何在 ASP.NET WebForms 中实现 TDD

Automapper - 映射器已初始化错误

如何使用 SmtpClient.SendAsync 发送带有附件的邮箱?

在 C# 中以编程方式添加元标记

在 asp.net 中调整图像大小而不会丢失图像质量

哪些行为驱动开发 (BDD) 工具/框架可用于 Microsoft Stack?

Asp.net Identity 密码哈希

如何在 IIS 7.5 上使用 ASP.NET 表单身份验证保护静态文件?

在 asp.net 中为动态 PDF 指定文件名

实体框架:如何解决外键约束可能导致循环或多个级联路径?

ASP.NET MVC 2.0 JsonRequestBehavior 全局设置

覆盖静态方法

会员生成密码 仅限字母数字密码?

服务器标签格式不正确错误