应用程序未在天蓝色云上运行

问题描述 投票:0回答:1

我已经使用 Microsoft Visual Studio“发布”在 Azure 云应用程序服务上部署了 ASP.NET Core 6 项目,但是当我打开部署的应用程序时,我不断出现

HTTP 错误 500.30 - ASP.NET Core 应用程序无法启动

我尝试从 Azure 控制台运行 .dll 以获取它返回的完整错误消息

未处理的异常:System.IO.FileNotFoundException:无法加载文件或程序集“System.Runtime,Version=6.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”或其依赖项之一。系统找不到指定的文件。

这些是已部署机器上的

web.config
appsettings.json

web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\app-core.dll" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" hostingModel="inprocess" />
    </system.webServer>
  </location>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v6.0.417" sku=".NETFramework,Version=V6.0.417" />
  </startup>
</configuration>
<!--ProjectGuid: d997d705-03bb-4182-8868-507e5d3cc0a1-->

appsettings.json

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*",
  "ConnectionStrings": {
    "DefaultConnect": "dbConnectionString"
  }
}

我在本地项目中使用它们,并且运行良好。

我也尝试了这个解决方案

gacutil
虽然安装了.NET SDK,但在Azure控制台上无法识别

azure deployment azure-web-app-service asp.net-core-6.0
1个回答
0
投票

我尝试了一个简单的 ASP。 NET 6 Core Web应用程序并通过Visual Studio将其部署到Azure App Service,并且成功了。

在 Azure 中使用 Web.config 文件时,我遇到了错误。随后,我将我的网络应用程序名称添加到 Web.config 文件中,如下所示:

 </handlers>
      <aspNetCore processPath="dotnet" arguments=".\<LocalWebAppName>.dll .\app-core.dll" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" hostingModel="inprocess" />

下面是我完整的 web.config 文件。

web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\kasampleapp.dll .\app-core.dll" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" hostingModel="inprocess" />
    </system.webServer>
  </location>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v6.0.417" sku=".NETFramework,Version=V6.0.417" />
  </startup>
</configuration>
<!--ProjectGuid: <Guid>-->

Azure 应用服务输出

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.