从ASP.NET Core 1.1迁移到2.0。出现“无法初始化CoreCLR,HRESULT:0x80004005”失败

贾高芬

我已经将应用程序从ASP.NET Core v1.1更新为ASP.NET Core 2.0。

在我的开发机上一切正常。但是当我部署到Azure时,我得到"HTTP Error 502.5 - Process Failure"了回应。

我已经在web.config中激活了日志记录:

<aspNetCore processPath=".\PublicWeb2.Web.exe" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />

日志显示:

无法初始化CoreCLR,HRESULT:0x80004005

如果我dotnet mysite.dll从Kudo中的命令提示符运行则会收到相同的错误

Azure中的事件日志给出以下错误:

具有物理根目录'D:\ home \ site \ wwwroot \'的应用程序'MACHINE / WEBROOT / APPHOST / XXXXX'无法使用命令行'D:\ home \ site \ wwwroot \ XXX'启动进程,ErrorCode ='0x80004005:80008089。

相关的Azure设置:

在此处输入图片说明

我完整的csproj:

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <UserSecretsId>XXXXXXXXXXX</UserSecretsId>
    <RuntimeIdentifiers>win7-x86;win7-x64</RuntimeIdentifiers>
    <WebProject_DirectoryAccessLevelKey>1</WebProject_DirectoryAccessLevelKey>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="MarkdownWeb" Version="1.3.4" />
    <PackageReference Include="MarkdownWeb.Git" Version="1.0.1" />
    <PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="2.0.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.0" />
    <PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
  </ItemGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" />
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\XXX\XXX.csproj" />
  </ItemGroup>

</Project>

云服务上安装的Dotnet版本:

D:\home\site\wwwroot>dotnet --info
.NET Command Line Tools (2.0.0)

Product Information:
 Version:            2.0.0
 Commit SHA-1 hash:  cdcd1928c9

Runtime Environment:
 OS Name:     Windows
 OS Version:  6.2.9200
 OS Platform: Windows
 RID:         win8-x86
 Base Path:   D:\Program Files (x86)\dotnet\sdk\2.0.0\


Microsoft .NET Core Shared Framework Host
  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

我所做的(通过阅读其他SO问题):

  • win7-x86在我的csproj中添加为第一个运行时标识符
  • 在Azure部署设置中选择了win7-x86
  • 使用Kudo中的控制台从wwwroot手动删除所有旧文件(然后再次部署)
  • 尝试过COREHOST_TRACE=1激活,但是控制台挂起了工藤(并且管道到日志不起作用,即dotnet myapp.dll > mylog.txt

我不知道下一步该怎么做。

贾高芬

终于成功了。

1.删​​除项目文件中的运行时标识符

在该Web项目的csproj文件中,我删除了该<RuntimeIdentifiers>元素(<RuntimeIdentifier>如果您指定了单个运行时)。

2.<RuntimeIdentifier>在发布配置文件中删除

可以在解决方案资源管理器中找到pubxml

Project -> Properties -> PublishProfiles -> yourfilename.pubxml.

删除以下行(已指定运行时)

<RuntimeIdentifier>win7-x86</RuntimeIdentifier>

保存文件并关闭它。

下次运行publish命令时,在Settings选项下应显示“ portable”

在此处输入图片说明

那对我有用。

因此,我的猜测是真正的解决方案是:

  1. 在Azure门户中停止该站点
  2. 使用工藤从“ wwwroot”文件夹中删除所有旧文件:https ://YOURSITE.scm.azurewebsites.net/DebugConsole ,运行“ rmdir / q / s”。在wwwroot文件夹中。
  3. 确保RuntimeIdentifier在发布配置文件中未指定任何编号
  4. 确保RuntimeIdentifier在csproj文件中未指定任何编号
  5. 发布网站
  6. 在Azure门户中启动网站

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

ASP.NET Core 2.0从发布的1.x迁移到Azure无法正常工作HTTP错误502.5-进程失败

ASP.NET Core 0x80004005

迁移到ASP.NET Core RC2后,集成测试失败

Azure Pipelines:迁移到 .NET Core 3.1 后,Dotnet 发布失败,退出代码为 1

从asp net 5迁移到asp net core时出错

独立的asp.net核心Web API正在获取:-无法在Ubuntu 16.10-x64上初始化CoreCLR,HRESULT:0x80131500

将Asp.Net Core 1转换为Core 2后Jwt无法正常工作

.Net Core无法加载hostpolicy.dll(HRESULT:0x800700C1)

将 ASP.NET Core 3.1 迁移到 .NET 5.0

无法使用ASP.net Core 2添加迁移

将Asp.Net Core 2.2 App迁移到3.1时的整数序列化

将HTML助手迁移到ASP.NET Core

ASP.NET Core RC1到1.0.0的迁移错误

为什么我从.net core rc1迁移到rc2时遇到这种不兼容性问题

从Webpack 1.x迁移到2.x

从Restlet 1.x迁移到2.x

从 1.x 迁移到 2.x?

将WCF绑定从ASP.NET迁移到ASP.NET Core完整框架

将ASP.NET多层应用程序迁移到ASP.NET Core

使用ASP.NET Core计算SHA1

AutoMapper无法使用ASP.NET Core将List <Model>(1项)转换为List <DTO>(0项)

迁移到ASP.Net Core MVC时JSON序列化/反序列化不起作用

Asp.Net Core 2.2 - 无法解析类型“...SignInHelper`1[...ApplicationUser]”的服务

无法在ASP.NET Core 1应用程序中使用Oracle托管驱动程序

将经典 ASP 应用程序迁移到 ASP.NET Core

在ASP.Net Core中创建初始迁移的问题

.NET Core应用由于ErrorCode ='0x80004005:80008083而无法在IIS中启动

ASP.NET Core 错误:数据库操作预计会影响 1 行,但实际上会影响 0 行

迁移到.NET Core 3.0后出现问题