【问题标题】:How to fix 500.30 - ASP.NET CORE app failed to start如何修复 500.30 - ASP.NET CORE 应用程序无法启动
【发布时间】:2021-05-23 12:32:21
【问题描述】:

在 IIS 上发布程序后,我们有这个错误

HTTP Error 500.30 - ASP.NET Core app failed to start
Common solutions to this issue:
The app failed to start
The app started but then stopped
The app started but threw an exception during startup
Troubleshooting steps:
Check the system event log for error messages
Enable logging the application process' stdout messages
Attach a debugger to the application process and inspect
For more information visit: https://go.microsoft.com/fwlink/?LinkID=2028265

我们检查标准输出日志文件后,出现这个错误

  at Microsoft.Extensions.Configuration.FileConfigurationProvider.HandleException(ExceptionDispatchInfo info)
   at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
   at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load()
   at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
   at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
   at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
   at Microsoft.Extensions.Hosting.HostBuilder.Build()
   at ArtanNet.Program.Main(String[] args) in C:\Users\Administrator\Desktop\ArtanNet\ArtanNet\Program.cs:line 16

program.cs文件代码为:

 public class Program
    {
        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseStartup<Startup>();
                });
    }

web.congi:

<?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=".\ArtanNet.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
    </system.webServer>
  </location>
</configuration>
<!--ProjectGuid: d6cea5f9-6e6d-4f03-b6e9-1d0fb599d508-->

现在请帮助我们修复此错误

【问题讨论】:

  • 检查系统事件日志中的错误消息 - 嗯 - 你呢?它告诉了你什么?
  • “应用程序启动但在启动过程中抛出异常”和“FileConfigurationProvider.HandleException”是原因的明确指标。
  • 似乎无法读取配置文件。确保它存在并且包含格式正确的 XML。
  • 您是否尝试过创建一个新的空核心应用程序并在 IIS 上发布?请发布 web.config 以便我检查 XML 代码的格式。
  • 面临同样的错误。我的应用程序在调试和发布模式下都能在我的机器上完美运行。如果我将它上传到服务器,Bud 不会。

标签: asp.net asp.net-core iis


【解决方案1】:

您使用的是哪个核心版本?您使用的是什么托管模型?进程中还是进程外?您可以在 csproj 文件中检查 thios。如果您使用 In of Process,请尝试将其更改为

 <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>

【讨论】:

  • Dotnet 版本:5.0.103 托管模型:ìn 进程
【解决方案2】:

我可以解决这个问题 我改变program.cs 并在 creatHostBuilder 中添加 webbulder.useiis()

 public class Program
    {
        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseStartup<Startup>();
                    webBuilder.UseIis();
                });
    }

【讨论】:

    【解决方案3】:

    当您尝试将已发布的软件包安装到 ISP 托管的共享 IIS 服务器或 ISP 托管的虚拟机时,也会出现此错误消息。

    • 部署模式:依赖框架
    • 目标运行时:Win-x64 或便携式

    在我的情况下,当我尝试部署 ASP.NET Core 5 应用程序时,由于没有为用户组(基本上是根文件夹)设置 Web 应用程序文件夹的更改(读/写/删除)权限而发生。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-07-16
      • 2023-01-09
      • 2021-09-11
      • 2022-10-01
      • 2021-12-08
      • 1970-01-01
      • 2021-12-13
      • 1970-01-01
      相关资源
      最近更新 更多