23

I deploy a .NET Core 5 app with settings: enter image description here

And the website shows an 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

What is causing this error?

zhulien
  • 4,274
  • 3
  • 15
  • 31
Paolo Constantin
  • 235
  • 1
  • 2
  • 4

20 Answers20

37

There may be a few reasons behind the error which you can only identify by debugging. You can try to debug this error using the steps below:

  1. Navigate to the root directory of the application using CMD
  2. Run the application using the command dotnet run (yourApplicationName).dll

If there are any errors, they should appear in the output.

Alternatively, you can check "Event Viewer" (search Event Viewer using Windows search) and navigate to

  • Windows Logs
    • Application

Update:

dotnet (yourApplicationName).dll

and check http://localhost:5000/ for error

biberman
  • 4,476
  • 4
  • 10
  • 34
uvylight
  • 389
  • 2
  • 3
16

enter image description here

Go there, and try to manually start your project... i.e.

dotnet ServerApp.dll

enter image description here

130nk3r5
  • 550
  • 6
  • 11
6

I recently encountered this issue deploying my .net core 5 app to IIS. I am using environment variables for my various envrionments and the web.config that was deployed was missing the xml tags.

Changing this line:

<aspNetCore processPath="dotnet" arguments=".\<your>.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess"/>

to:

<aspNetCore processPath="dotnet" arguments=".\<your>.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess">
   <environmentVariables>
        <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Local" />
   </environmentVariables>
</aspNetCore>

This fixed my 500.30 issue.

I took guidance from @Mohammed https://stackoverflow.com/a/59390437/6155498

PaulGrant
  • 99
  • 1
  • 4
5

open Windows Event Viewer, find the error message and click it, open the Detail tab, you will see the exception.

Harrison Wu
  • 106
  • 1
  • 3
2

Check whether the attribute value of hostingModel in the configuration file is OutOfProcess. If the value of the hostingModel property is InProcess, try to change it to OutOfProcess and start the project again.

Ding Peng
  • 3,312
  • 1
  • 3
  • 7
  • this is my .csjproj PropertyGroup net5.0 ManToc.Api.xml 1701;1702;1591 07acd440-eb4a-416e-b906-90c692d326b3 – Paolo Constantin Apr 24 '21 at 22:07
  • You can refer to this link to set the value of the hostingModel property: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/out-of-process-hosting?view=aspnetcore-5.0 – Ding Peng Apr 26 '21 at 07:16
  • You may also have to delete the _web.config_ file in the app service and republish the site so that web.config actually changes. – CrispinH Dec 31 '21 at 13:35
2

This is a very vague error message, there can be 100s of different reasons behind it. Check your server error logs.

In my case Redeploying the application targeting the 64-bit platform fixed the issue.

Manzur Alahi
  • 1,463
  • 20
  • 17
2

I had this error running the application on local IIS in windows 10, then I gave full control permission to IIS_IUSRS for App_Data and Logs folders so it worked.

enter image description here

Jalaleddin Hosseini
  • 1,794
  • 2
  • 18
  • 23
2

I got the error using Azure App Service

HTTP Error 500.30 - ASP.NET Core app failed to start

The documentation and App Service logs did not get me anywhere.

https://docs.microsoft.com/en-gb/aspnet/core/test/troubleshoot-azure-iis?view=aspnetcore-6.0#50030-in-process-startup-failure

I then logged on to the database and checked Firewalls and virtual networks and saw that Allow Azure services and resources to access this server was set to No. Switching Allow Azure services and resources to access this server to Yes solved the error.

enter image description here

A good place to check is also Azure App Service - Diagnose and solve problems. Another problem I had could be solved using Application Event Logs.

enter image description here

In this case it was the error:

System.InvalidOperationException: Couldn't find a valid certificate with subject 'CN=certificate' on the 'CurrentUser\My'

Turned out I had a expired certificate, renewed and everything worked.

Ogglas
  • 50,115
  • 30
  • 272
  • 333
1

This may happen, when something is wrong with Startup.cs file. For instance it can be placing interface instead of realization class

services.AddScoped<IService, IService>();

When you need to specify realization class:

services.AddScoped<IService, Service>();
Sergiy Velychko
  • 307
  • 4
  • 5
1

Ran into this problem today (NET 5 app, win-x64 target runtime). I managed to fix it by disabling 32-bit applications support in the IIS Application Pool (see screenshot below):

IIS Application Pool configuration

As soon as I've switched from Enable 32-Bit Applications: true to false, the HTTP Error 500.30 disappeared.

For additional info, see this post on my blog.

Darkseal
  • 9,334
  • 8
  • 75
  • 104
1

I also encountered this bug. With the difference that the target framework of my program is .NET 6.

The mistake I made was not to put the app.Run() command in the Program.cs.

goodiano
  • 11
  • 2
1

Sometimes you need to refresh the application pool in combination with one of the aforementioned solutions.

Farzad M.
  • 150
  • 3
  • 12
0

On my end, I found that on Azure, I accidentally chose .NET Core 3.1, whereas I was deploying an app targeting ASP.NET Core 5.0. After changing the version to .NET 5.0 on the Azure App Service, it works.

enter image description here

Jeremy Caney
  • 6,191
  • 35
  • 44
  • 70
A SHAHZAD
  • 126
  • 2
0

I found out how to fix this issue. If your project is inside of a folder that has been renamed or moved, that means you need to change the folder and drive for that route. If your project is in the drive d:\, leave that and make a new folder in another drive like e:\ or c:\ and test it again.

Jeremy Caney
  • 6,191
  • 35
  • 44
  • 70
  • 3
    Please use proper spelling and punctuation when posting on this site. – General Grievance Jul 26 '21 at 20:54
  • 1
    I’ve made a best effort to clarify the instructions here. I’m not confident that I understood the intent, though, so please review and confirm. This is my area of expertise, yet I’m not entirely clear how this guidance relates to this problem. – Jeremy Caney Jul 27 '21 at 04:38
0

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 user group, basically the root folder.

Dush
  • 1,007
  • 23
  • 26
  • How did you give the permission exatly? Publishing it self contained? – AsIndeed Dec 20 '21 at 07:47
  • @AsIndeed, yes I gave them permission to the app. Regarding the next question "Publishing it self-contained?" the answer is above on my answer, read the answer carefully. It is "Framework-Dependent" not "self-contained". Actually, I did not try with "self-contained" deployment mode. – Dush Dec 23 '21 at 23:02
0

Try to change deployment mode into self contained

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 30 '21 at 00:08
0

if your host bundle is 5 and also your app is 5 or your host bundle is 6 and aslo your app is 6

(for check host version :
NetCoreVersion=@Environment.Version
)

then, set this in your publish setting befr publish:

(Deployment mode: self-contained & Target Runtime: Win-x64 or Portable) this option added ~75MB~ necessary files to your published project

0

Another possible reason: The app throws an exception at startup, e.g. in a static initializer or the like. In that case, the eventlog does not always show any related entries at all, but the console output will tell.

JensG
  • 12,640
  • 4
  • 45
  • 54
0

I solved this error, using this information,

this issue is mainly with the appsettings.json, the error is caused by the unwanted character in the appsettings.json. To find out exactly what the cause of the HTTP Error 500.30 is, start an application called EventViewer and navigate to System Events. You will be able to see an Event Log of IIS and the main cause of an Error.

sources : https://www.ernestech.com/articles/details/6899/http-error-500.30---aspnet-core-app-failed-to-start#:~:text=but%20then%20stopped-,Answer%3A%20To%20be%20able%20to%20troubleshoot%20this%20issue%20is%20mainly,and%20navigate%20to%20System%20Events.

turns out I had given a wrong path in appsettings.json with too many slashes ////.

0

I have .Net 6 application I was getting this issue because I had some errors in Dependency Injection. Best way would be to put the try catch over your CreateWebHostBuilder in Program.cs, either throw the error or Log it anywhere or put a debugger.

I was missing some dependency mapping.

Use this way to find the error:

            try
            {
                Log.Information("Starting Service");
                CreateWebHostBuilder(args).Build().Run();
                return 0;
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, "Terminated");
                return 1;
            }
KushalSeth
  • 1,901
  • 1
  • 15
  • 25