在 Azure 中托管 Asp.Net Core 3.0:HTTP 错误 500.31 - ANCM 无法找到本机依赖项

Hosting Asp.Net Core 3.0 in Azure: HTTP Error 500.31 - ANCM Failed to Find Native Dependencies

我正在尝试在 Azure 中托管 ASP.NET Core 3.0 API:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
  </PropertyGroup>

  <PropertyGroup>
    <IsPackable>false</IsPackable>
    <NeutralLanguage>en-US</NeutralLanguage>
    <LangVersion>latest</LangVersion>   
  </PropertyGroup>  

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="3.*" />
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.*" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.*" />
    <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="3.*" />
  </ItemGroup>       

</Project>

但是当我 运行 申请时,我得到:

HTTP Error 500.31 - ANCM Failed to Find Native Dependencies

Common solutions to this issue:
The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found.
Specific error detected by ANCM:
It was not possible to find any compatible framework version The specified framework 'Microsoft.AspNetCore.App', version '3.0.0' was not found. - The following frameworks were found: 2.1.12 at [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App] 2.1.13 at [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App] 2.2.6 at [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App] 2.2.7 at [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App] You can resolve the problem by installing the specified framework and/or SDK. The .NET Core frameworks can be found at: - https://aka.ms/dotnet-download

我错过了什么?

ASP.NET Core 3.0 not currently available for Azure App Service. [微软文档]

preview versions of .NET Core 3.0 [Microsoft 文档] 在 Azure 服务上可用。

目前的picture是ASP.NETCore 3.0随处可用(但不是SDK)

尽管如此,我(看似随机地)得到了一个

HTTP Error 500.31 - ANCM Failed to Find Native Dependencies

直到我意识到通过将 stdoutLogEnabled 设置为 true 而无需 stdoutLogFile 调整为 [来激活登录 web.config =15=](如 Troubleshoot ASP.NET Core on Azure App Service and IIS 中所建议)是此错误消息的原因。

我花了几个小时才意识到这种因果关系。

在 web.config 中更改:

<handlers>
     <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>

对此:

<handlers>
     <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>

我从这个 modules="AspNetCoreModuleV2" 中删除了 V2,它起作用了。