Most of the time, “an unexpected error occurred” error message irritates the asp.net developers. It is the least informative message that doesn’t provide much detail, at least not inside a production environment. Still, there are ways to understand and fix such errors. Troubleshooting the errors of the application is not a fun thing to do. The time gets wasted and developers could write code on some interesting new project. In this article, we will talk about some tips on finding failed asp.net requests and troubleshooting them.
4 Different types of IIS Logs
If you are a developer, you must be familiar with normal IIS logs. However, there are other different places to look if you are searching for detailed error messages or unable to find anything in IIS log file.
- Standard IIS logs
Standard IIS logs include every single web request flowing through the IIS site of the developer. A development team can use IIS manager to verify and check if their IIS logs are enabled and the place where they are being written to.
The logs can be found in the folders that are named by their W3SVC site ID numbers. Each logged request in IIS log will have many key fields by default, including the query string, URL, and error codes through the status, win32 status, and substatus. Developers can take help of these status codes to detect the real error in more detail.
- HTTPERR is the IIS Error Log
Not a single web request should be hidden in your IIS log. If it does, there is a chance that the request never made to IIS, or IIS wasn’t running. You must check if the IIS logging is enabled.
Incoming requests to your server initially route via HTTP.SYS prior delivered to IIS. Such errors get logged within HTTPERR. Common types of errors are timeouts, 400 Bad Requests, 503 Service Unavailable, and relevant issues. The error codes from HTTP.SYS and built-in error messages provide detailed information.
- Find out Asp.net exceptions in Windows Event Viewer
There is a default setting in which Asp.net logs unhandled 500 level exceptions to the Windows Application EventLog. Asp.net Health monitoring feature is there to handle it. Developers are able to control settings for it through the system.web/health monitoring in their web.config file.
- Failed request tracing
FRT or failed request tracing is one of the least applied features in IIS. This feature offers robust IIS logging and works as an ideal IIS error log. IIS manager has enabled FRT that can be configured through rules for all slow requests, requests, or just few response status codes.
The issue with FRT is its detailed information. The feature tracks every minor detail and every step of the IIS pipeline. So, it’s a time-consuming thing.
How to troubleshoot asp.net website application errors?
First thing to find out is that if the web app returning lots of errors or not. When you know your errors like 503 services unavailable, 500 internal server error, or similar errors, troubleshooting becomes easy.
503 service unavailable error
If your IIS app pool is stopped, it will show only 503 errors on every request. You must check that the IIS application Pool is set to started, since at times, IIS application Pool switches to a stopped state and the reasons could be configuration problems, W3WP crashing, etc.
What to do if every page load cause 500 internal server error or an exception?
If this is a situation, developer needs to check their error logs quickly. It is the type of issue and the way of doing exception logging that logs to a file or error tracking tool. Developers would also check Windows Event Viewer if they could gain access to it.
If every page load shows an exception, there is a configuration problem in Web.config or ApplicationHost.config. There are chances of having an issue with asp.net session provider, caching or other app dependencies used on each web request.
If the app is throwing an exception when the page is loaded, developers may not be able to see the details. This makes troubleshooting hard. Only the standard asp.net error page or custom error page is shown.
Developers of Asp.net Development Company in India could temporarily disable their custom error page and allow asp.net to show the complete exception details. This method could show potentially sensitive data and it could be helpful if the app is down and developers desire for an instant solution.
In this article, we have shared the ways to find failed asp.net web app requests along with troubleshooting tips. If you need extra information on the troubleshooting of requests, you can read online detailed articles. There are IT services vendors offering troubleshooting guide for developers. You can find such partners and get help.
If you find this article interesting, do feedback in the comment section. Thanks in advance!