8

Well after publishing the program on IIS, we have this error

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

After we check stdout log file, this Error appears

  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 file code is:

 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.congig:

<?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-->

and now please help us to fix this error

mohammad rahimi
  • 148
  • 1
  • 1
  • 11
  • *Check the system event log for error messages* - well - did you? What did it tell you? – marc_s Feb 20 '21 at 19:53
  • 1
    “The app started but threw an exception during startup” and "FileConfigurationProvider.HandleException" are clear indicators of the cause. – Lex Li Feb 20 '21 at 20:08
  • 1
    Seems like it having trouble reading the configuration file. Make sure it is present and contains well-formed XML. – John Wu Feb 20 '21 at 20:33
  • Have you tried to create a new empty core application and published on IIS? And please post web.config so that I can check the format of XML code. – Bruce Zhang Feb 22 '21 at 07:46
  • 1
    Facing the same error. My app works on my machine perfectly in both debug and release mode. Bud doe not if I uploaded it to the server. – Mahmudul Hasan Jul 17 '21 at 06:36

9 Answers9

9

Which Core version are you using? And what Hosting Model you are using? IN Of Process or Out of Process? You can check thios in you csproj file. if you using In of Process, try to change it to

 <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
  • Dotnet version : 5.0.103 hosting model:ìn process – mohammad rahimi Feb 21 '21 at 12:31
  • 2
    Just FYI - there's a trade off for changing it, as per [MS doco](https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/in-process-hosting?view=aspnetcore-6.0). "In-process hosting provides improved performance over out-of-process hosting because requests aren't proxied over the loopback adapter". – fuzzy_logic May 20 '22 at 02:40
  • Trying out of process I get on my local IIS: `HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure`. In addition, log is empty – johnnyontheweb Nov 29 '22 at 18:10
6

HTTP Error 500.30 - ASP.NET Core app failed to start is a very generic error message.

To get a more specific exception message you have to set enable ASPNETCORE_DETAILEDERRORS. To do that in Azure Portal follow these steps:

  1. Navigate to the Azure Portal and open your App Service application.
  2. In the left-hand menu, click on "Configuration".
  3. Scroll down to the "Application settings" section and click on the "New application setting" button.
  4. In the "Name" field, enter ASPNETCORE_DETAILEDERRORS (without the quotes).
  5. In the "Value" field, enter true (without the quotes).
  6. Click on the "OK" button to save the setting.

Now when you will open your app an detailed exception will be shown in place of the generic HTTP Error 500.30 - ASP.NET Core app failed to start.

FelixB
  • 61
  • 1
  • 2
  • 2
    This saved me a lot of time. I could not see any relevant info in other logs. After enabling detailed errors I new exactly what the problem was. In my case the issue was with Microsoft.Extensions.Logging 6.0.14. For whatever reason it was not available in Azure app service under a subscription used for staging. I had no issues with the same app in dev subscription. Weird! – bdristan Apr 22 '23 at 17:21
4

I can fix this issue I change program.cs and add webbulder.useiis() in creatHostBuilder

 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();
                });
    }
mohammad rahimi
  • 148
  • 1
  • 1
  • 11
4

We've just encountered this with .net core 6.0.1. The issue turns out to be that our server had both the 64bit and 32bit versions of ASP.NET Core 6.0.1 Shared Framework installed. We removed the 32bit version, rebooted the server, sent a stern email to our server team and all worked fine ;-)

Phil Jones
  • 86
  • 5
2

Also this error can show that your application has errors in config files (most common appsettings.json) so it can't be deserialized properly

Tropin Alexey
  • 606
  • 1
  • 7
  • 16
1

This error message also comes when you try to install the published package to the ISP-hosted shared IIS server or an ISP-hosted Virtual Machine.

  • Deployment mode: Framework-Dependent
  • Target Runtime: Win-x64 or Portable

In my case, when I tried to deploy ASP.NET Core 5 application, it occurred due to not setting the change (read/write/delete) permission to the web application folder for the admin user, basically the root folder.

Dush
  • 1,185
  • 26
  • 29
0

Faced similar issue of timeout while migrating our application from netcoreapp2.0 to .net 6. We were using .UseIISIntegration() in Program.cs. Changing it to .UseIIS() solved the problem.

0

If you have already checked below

  1. Corresponding dotnet runtime is installed (Command: dotnet --info)
  2. handler / target framework is specified

Then, try to run your project.dll Command: dotnet your_project.dll

The error shown there can give direction to your troubleshooting.

AnkitK
  • 388
  • 3
  • 10
0

500.30 can also be a KeyVault configuration issue or a startup issue with the application. In my case, it was that my managed identity did not have get/list on my targeted KeyVault.

interesting-name-here
  • 1,851
  • 1
  • 20
  • 33