Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Core hosting - 500 internal server error

Tags:

I am trying to publish as ASP.NET Core project with a hosting provider that supports ASP.NET Core. I am getting 500 Internal Server Error which I believe is very common. So I searched through the internet and various forums and then I checked the processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" in web.config and they look to be correctly converted with processPath="dotnet" and arguments=".\MyApplication.dll".

I also checked the connection string and it points to production DB server that's working. I confirmed the DB connection by changing the connection string to production DB and running project local. It works and I get the production DB access.

I also tried to get the error info by using the below in my Startup.cs (irrespective of env):

app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); app.UseBrowserLink(); 

I have also enabled stdoutLog in web.config, but I don't see that folder either:

stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" 

I also tried to change applicationUrl and launchUrl in launchSettings.json to my prod Url, but that didn't work as well.

So, the 500 Internal Server Error refuses to go away, and I still don't have a useful error message. The page just says:

Oops. 500 Internal Server Error An error occurred while starting the application.

I would really appreciate if someone could help me here.

like image 639
user6542823 Avatar asked Jan 07 '17 21:01

user6542823


People also ask

How do I fix a 500 Internal server error?

Clear your browser cache and cookies Check these articles on deleting the cache on an Android phone or iPhone, if you use a mobile device. Alternatively, you can test opening the page from another browser. For instance, if you use Chrome, try Firefox or vice versa.

How do I fix 500 internal server error IIS?

IIS error The error 500.19 is an internal server error often occurring on a server using Microsoft IIS software. It indicates that the configuration data for the page is invalid. To solve the issue, delete the malformed XML element from the Web. config file or from the ApplicationHost.

What is an ASP 500 error?

HTTP Error 500 message indicates that a problem has occurred on the Web server that hosts the Web site at the time the error is returned.

Is 500 an internal server error?

The HyperText Transfer Protocol (HTTP) 500 Internal Server Error server error response code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request. This error response is a generic "catch-all" response.


1 Answers

I have also enabled stdoutLog in web.config as but I don't see that folder either:

stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout"

There is one trick here - you must create both folders logs and stdout manually - then and only then IIS will create log file inside logs folder (not stdout as you could expect) - don't ask me why, because I don't know why ;)


Oops. 500 Internal Server Error An error occurred while starting the application.

Usually, means problems with a configuration in Startup.cs - the most common problems include an issue with DB itself, an issue with migrations (if you are using Code First approach), problems with appsettings.js, problems with Social Logins credentials (like missing SecretKey)...

Please refer to log file in .\logs\stdout - this is the quickest way to find details about the problem :)


app.UseDeveloperExceptionPage();

app.UseDatabaseErrorPage();

Those will work after your WebApp fully started, but not while starting the application.

like image 138
Lukasz Mk Avatar answered Sep 20 '22 19:09

Lukasz Mk