'HTTP Error 500.30 - ASP.NET Core 5 app failed to start
I deploy a .NET Core 5 app with settings:
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?
Solution 1:[1]
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:
- Navigate to the root directory of the application using CMD
- 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
Solution 2:[2]
Solution 3:[3]
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
Solution 4:[4]
open Windows Event Viewer, find the error message and click it, open the Detail tab, you will see the exception.
Solution 5:[5]
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.
Solution 6:[6]
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.
Solution 7:[7]
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.
Solution 8:[8]
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.
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.
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.
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.
Solution 9:[9]
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>();
Solution 10:[10]
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):
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.
Solution 11:[11]
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
.
Solution 12:[12]
Sometimes you need to refresh the application pool in combination with one of the aforementioned solutions.
Solution 13:[13]
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.
Solution 14:[14]
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.
Solution 15:[15]
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.
Solution 16:[16]
Try to change deployment mode into self contained
Solution 17:[17]
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 :
[email protected]
)
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
Solution 18:[18]
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.
Solution 19:[19]
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.
turns out I had given a wrong path in appsettings.json
with too many slashes ////.
Solution 20:[20]
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;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow