我已经将项目迁移到asp.net core 3.1,但是当我部署到Azure Web应用程序时,它无法启动。
显示错误
HTTP错误500.31-ANCM无法找到常见的本地依赖项 解决此问题的方法:指定的版本 找不到Microsoft.NetCore.App或Microsoft.AspNetCore.App。 故障排除步骤:检查系统事件日志中是否有错误消息 启用记录应用程序进程的标准输出消息的步骤 调试程序并检查应用程序
<EventData>
<Data>Could not find 'aspnetcorev2_inprocess.dll'. Exception message:
Invalid runtimeconfig.json [D:\home\site\wwwroot\Flymark.Online.Web.runtimeconfig.json] [D:\home\site\wwwroot\Flymark.Online.Web.runtimeconfig.dev.json]
</Data>
<Data>Process Id: 23260.</Data>
<Data>File Version: 13.1.20074.3. Description: IIS ASP.NET Core Module V2. Commit: e81033e094d4663ffd227bb4aed30b76b0631e6d</Data>
</EventData>
OR
<EventData>
<Data>Could not find 'aspnetcorev2_inprocess.dll'. Exception message:
Failed to load the dll from [D:\home\site\wwwroot\hostpolicy.dll], HRESULT: 0x8007007E
An error occurred while loading required library hostpolicy.dll from [D:\home\site\wwwroot\]
</Data>
<Data>Process Id: 21176.</Data>
<Data>File Version: 13.1.20074.3. Description: IIS ASP.NET Core Module V2. Commit: e81033e094d4663ffd227bb4aed30b76b0631e6d</Data>
</EventData>
我正在使用build.yml在azure dev ops中构建我的应用程序
steps:
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '3.1.x'
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: restore
projects: '**/*.csproj'
vstsFeed: 'a8d40e20-5070-473a-8928-33122e7035b7'
- script: dotnet tool install --global dotnet-ef
displayName: 'dotnet install ef'
workingDirectory: Source
- script: dotnet publish -c Release -r win-x64 --self-contained
displayName: 'dotnet publish web'
workingDirectory: Source/Web
- script: dotnet ef migrations script --idempotent --project Online.Db --startup-project web -o $(Build.ArtifactStagingDirectory)/Online.Db.sql
displayName: 'Prepare sql scripts'
workingDirectory: Source
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: 'Source/Web/bin/Release/netcoreapp3.1/win-x64/publish'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/Web.zip'
replaceExistingArchive: false
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: Release'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: Release
condition: succeededOrFailed()
在azure dotnet上--info返回
.NET Core SDK (reflecting any global.json):
Version: 3.1.103
Commit: 6f74c4a1dd
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x86
Base Path: D:\Program Files (x86)\dotnet\sdk\3.1.103\
Host (useful for support):
Version: 3.1.3
Commit: 4a9f85e9f8
.NET Core SDKs installed:
1.1.14 [D:\Program Files (x86)\dotnet\sdk]
2.1.513 [D:\Program Files (x86)\dotnet\sdk]
2.2.109 [D:\Program Files (x86)\dotnet\sdk]
3.1.103 [D:\Program Files (x86)\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.14 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.17 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.8 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.14 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.17 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.8 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.1 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.3 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.3 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.16 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.13 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.17 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.3 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.3 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
我认为问题是点点滴滴,因为dotnet信息返回win10-x86,但是当我创建新的核心应用程序并从Visual Studio进行部署时,效果很好。
答案 0 :(得分:2)
这太疯狂了。.花了一周的时间,我进行了web.config转换并将其更改为stdoutLogFile=".\logs\stdout"
之后,问题终于变成stdoutLogFile="\\?\%home%\LogFiles\stdout"
答案 1 :(得分:0)
因此 Azure 中的 ANCM 错误似乎从未真正对应于 ANCM 消息。例如,如果它抱怨缺少依赖项,则可能是因为在 Startup.cs 中抛出了未处理的异常。是的。
查看“真实”错误的最快方法是尝试从 Kudu 运行应用程序(Azure 应用程序 -> 开发工具部分 -> 高级工具 -> “Go”,使用浏览器终端运行 {{1 }} 只需输入其路径并按回车键即可)。解决 ANCM 错误后,您将收到“app 在 localhost:5000 上启动”或类似的信息。否则,它会显示一个堆栈跟踪,告诉您确切的问题所在。