Hi,
For now see https://stackify.com/beyond-iis-logs-find-failed-iis-asp-net-requests/ and in particular #3 to first get details. http 500 means an error happens on the server when processing the request and so the first step is to understand which server side error happened.
500 - Internal server error
Hi,
The project was properly deployed on the server but I has the issue below. What to check it further?
Server Error
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
.NET
ASP.NET
-
AgaveJoe 26,201 Reputation points
2022-12-20T16:55:45.963+00:00 Check the normal stuff... start with the Event Viewer.
Keep in mind, you tagged this question with two completely different frameworks. If this is a Core application then turn on logging. See the official documentation.
-
Peter_1985 2,486 Reputation points
2022-12-21T01:54:45.92+00:00 I want to see the way to resolve it. How to identify the error?
-
Zhi Lv - MSFT 32,011 Reputation points • Microsoft Vendor
2022-12-21T06:18:16.423+00:00 Hi @Peter_1985 ,
Whether your application is an Asp.net core application or a .Net Framework(.Net 4.X) application? Before deploying the application on server, whether the application works well on local environment? And it is better to explain more detail about the server environment, windows or linux, use IIS or not? -
Peter_1985 2,486 Reputation points
2022-12-21T06:27:51.933+00:00 Hi,
It is under Windows server 2016. How to locate the exact error of this? -
Zhi Lv - MSFT 32,011 Reputation points • Microsoft Vendor
2022-12-22T02:04:27.763+00:00 Hi @Peter_1985 ,
Before deploying the application on IIS, whether the application works well on local/Development environment?
Generally, when meeting the 500 error on IIS, we could refer to the following steps to narrow down the problem:
- Check that you set up right Environment Name using ASPNETCORE_ENVIRONMENT environment variable as so use correct settings like connection string. On your machine by default you have "Development" environment.
- You may use Error Handling middlewares for showing exceptions like
app.UseDeveloperExceptionPage();
- Set the
stdoutLogEnabled
andstdoutLogFile
attributes of theaspNetCore
element. Then in the output log file, check the log, you might find some useful information. More detail information, see Log creation and redirection.
Best regards,
Dillion -
Peter_1985 2,486 Reputation points
2022-12-22T06:30:35.173+00:00 Hi,
Where should we capture the error exception, regarding the current problem/error? -
AgaveJoe 26,201 Reputation points
2022-12-22T12:29:28.593+00:00 You still have not told us what kind of application you've build ASP.NET or Core. 500 errors after a deployment are commonly due to configuration errors. For example, the connection string is wrong.
As stated above, the first step is reviewing the Windows Event Viewer for errors.
If you cannot view the event viewer and this is a .NET Core web application then update the web.config to log errors.
-
Peter_1985 2,486 Reputation points
2022-12-23T06:49:17.95+00:00 Hi,
Can you help? -
Zhi Lv - MSFT 32,011 Reputation points • Microsoft Vendor
2022-12-23T06:49:45.39+00:00 Hi @Peter_1985 ,
Have you ever tried the previous suggestion?
Besides, when you meet the 500 error? Access the specified page or the whole web site will show the 500 error? -
Peter_1985 2,486 Reputation points
2022-12-23T07:44:20.33+00:00 Hi,
Can you have more code/details to make use of app.UseDeveloperExceptionPage()? Yes, I got the error when accessing the only one web page of the deployed project. -
AgaveJoe 26,201 Reputation points
2022-12-24T19:44:52.67+00:00 You've been given detailed instructions with links but there is no indication that you've followed the recommendations. Can you tell us what troubleshooting steps you've performed?
Can you have more code/details to make use of app.UseDeveloperExceptionPage()?
According to the definition of a 500 error, the server encountered an unexpected condition that prevented it from fulfilling the request. Depending on the error, the developer exception page might not help but it is worth a try. Did you deploy configuration that makes use of the developer exception page?
Yes, I got the error when accessing the only one web page of the deployed project.
Only one page causes the 500 exception? The other pages function as expected? Is there there any way you can share the all the relevant source code?
-
Peter_1985 2,486 Reputation points
2022-12-27T03:43:59.067+00:00 Hi,
There was no change to the relevant project but such issue did happen. Must I use exception to capture the exception?Do you have the clear example to capture the exception? Can we catch it well within Page_load?
-
Zhi Lv - MSFT 32,011 Reputation points • Microsoft Vendor
2022-12-27T07:29:34.567+00:00 Hi @Peter_1985 ,
Do you have the clear example to capture the exception? Can we catch it well within Page_load?
It seems that your application is an Asp.net 4.X application(.net Framework), instead of an Asp.net core application. If you can tell us your application is an Asp.net 4.X Web Form application (it contains the Page_Load method), it might be easier for us to give you the correct direction or suggestion.
So, you can ignore my previous suggestion, because they are applying to Asp.net Core Application, instead of applying to ASP.NET 4.x. More detail information, see ASP.NET 4.x and ASP.NET Core or .NET vs. .NET Framework for server apps.
For Web Form application, after deploying meeting the 500 error, you can refer to this thread and enable the detailed error messages on IIS to check the detailed error message.
Best regards,
Dillion -
Peter_1985 2,486 Reputation points
2022-12-27T07:36:48.783+00:00 Hi,
Yes, it is running v 4.0 ASP.net. How to identify the exact error of this? There was no change ever done but it did happen. -
Zhi Lv - MSFT 32,011 Reputation points • Microsoft Vendor
2022-12-27T07:42:47.43+00:00 I want to confirm with you another question: before deploying the application on IIS, the application works well on local/Development environment or not?
-
Peter_1985 2,486 Reputation points
2022-12-27T08:00:58.27+00:00 Yes, everything was fine (currently before it happened).
I even did no change but this error did strangely happen.
-
AgaveJoe 26,201 Reputation points
2022-12-27T13:08:54.327+00:00 It has been 7 days and we just figured out this is a Web Forms question. Secondly, there is no indication that you've followed any of the advice given on these forums or what troubleshooting steps you've performed.
I'm not sure how we can help you if you do not communicate with the community.
-
Peter_1985 2,486 Reputation points
2022-12-28T08:23:00.713+00:00 Hi ZhiLv,
Any other update on this? -
Peter_1985 2,486 Reputation points
2022-12-28T09:34:58.22+00:00 Hi ZhiLv,
I tried to capture the exception via the condition (!IsPostBack) within Page_load, but I could not catch any exception from that. -
MotoX80 31,571 Reputation points
2022-12-28T12:52:05.353+00:00 Please see the answer from @PatriceSc
That web site documents the procedures that you need to perform to troubleshoot a 500 internal server error.
Sign in to comment
-
PatriceSc 166 Reputation points
2022-12-27T09:52:41.833+00:00