azure - ASP.NET Core 3.1.2 应用程序无法在 Azure 应用服务中启动

标签 azure asp.net-core .net-core azure-web-app-service asp.net-core-3.1

我已将应用程序从 ASP.NET Core 2.2.0 更新到 3.1.2,但它不再在 Azure 应用服务中运行。

v3.1.2 运行时未列为应用服务主机支持的运行时。 Kudu api/diagnostics/runtime 调用仅返回旧版本:

  ...
  "dotnetcore32": {
    "shared": {
      "microsoft.netcore.app": [ "1.0.16", "1.1.13", "2.0.9", "2.1.14", "2.2.8", "3.0.2", "3.1.1" ],
      "microsoft.aspnetcore.app": [ "2.1.14", "2.1.15", "2.2.8", "3.0.1", "3.0.2", "3.1.0", "3.1.1" ],
      "microsoft.aspnetcore.all": [ "2.1.14", "2.1.15", "2.2.8" ]
    },
    "sdk": [ "1.1.14", "2.1.509", "2.2.109" ]
  },
  "dotnetcore64": {
    "shared": {
      "microsoft.netcore.app": [ "1.0.16", "1.1.13", "2.0.9", "2.1.14", "2.2.8", "3.0.2", "3.1.1" ],
      "microsoft.aspnetcore.app": [ "2.1.14", "2.1.15", "2.2.8", "3.0.1", "3.0.2", "3.1.0", "3.1.1" ],
      "microsoft.aspnetcore.all": [ "2.1.14", "2.1.15", "2.2.8" ]
    },
    "sdk": [ "1.1.14", "2.1.509", "2.2.109" ]
  },
  ...

我认为我可以通过以独立模式部署应用程序来解决这个问题。但是该应用程序现在失败了:

System.InvalidOperationException: Startup assembly Microsoft.AspNetCore.AzureAppServices.HostingStartup failed to execute. See the inner exception for more details.
 ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.AzureAppServices.HostingStartup, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File name: 'Microsoft.AspNetCore.AzureAppServices.HostingStartup, Culture=neutral, PublicKeyToken=null'
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, RuntimeAssembly assemblyContext, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors)

我想知道:

  • 为什么独立模式不起作用?
  • Azure 应用服务上的 3.1.2 运行时支持是否有任何计划?
  • 我在 Azure 门户的站点扩展中看到了 ASP.NET Core 运行时 3.1.2,但安装它并没有帮助。扩展名有什么用?

最佳答案

我已经将一些使用 asp.net core 3.1.2 的应用程序部署到 Azure 应用程序服务,并且它们运行顺利。看看这个link

These approaches are also used when the runtime is available but the SDK hasn't been installed on Azure App Service.

准确回答您的问题

  1. 自包含模式应该可以工作。请确保您关注these steps

  2. dotnet core 3.1.2已在应用服务中提供,但需要手动安装。详情请查看this

  3. 抱歉,我帮不了你,我从来没有使用过上述扩展。

关于azure - ASP.NET Core 3.1.2 应用程序无法在 Azure 应用服务中启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60638193/

相关文章:

azure - Microsoft Graph API - 使用 Microsoft 帐户创建用户

arrays - 使用 Azure 逻辑应用将 CSV 元素转换为单个数组

c# - 执行异步查询 Azure 表存储的最佳方式

visual-studio - 为什么 Visual Studio 中的 csproj 文件没有获取最新版本的 .NET 6.0 和 .NET 7.0

c# - 在 .NET Core 中使用数据表

c# - UWP NetworkConnectionChanged 事件

c# - 我应该在 NETPortable 中引用哪个,找不到 GetMethods

azure - 如何更新Azure管道上的maven Artifact 的版本?

c# - 如何在 .NET Core 控制台应用程序中处理 Scoped 服务实例?

azure - 从命令行将 ASP.NET Core 1.1 应用程序部署到 Azure