Pro Code Guide

Developer’s Guide To Programming

HOME    CONTACT   ABOUT

Analyze ASP.NET Application Issues with Accuracy

Updated Nov 30, 2020 | 0 comments

Looking to analyze ASP.NET Application issues then here is an article which talks about where you need to look. Most of the time you will be able to analyze asp.net related application issues using the below-mentioned techniques.

IIS Logs

First make sure that you have enabled IIS logs, configured path for IIS logs, and are logging all the important/required fields for analysis. I personally prefer to select all the fields for the log. In case you need help on how to configure IIS logs then you can check this article on how to configure IIS Logs. IIS logs will typically contain a single entry for each request to the site which contains the date/time of the request, URL, query-string, response status with sub status, time-taken, and many more fields that provides details of each request. Refer here for a complete list of W3C log fields.

Error codes, in case of error, are available in status substatus and win32 status which can help identify the details of the error. Status is normal HTTP response codes like 200 means ok, 404 – not found, 500 – Internal server error mostly refers to application error (complete list of HTTP response status codes), etc. sc-win32-status can provide more details about the underlying error. IIS Logs helps to analyze asp.net application issues like failing requests, slow requests, etc.

Also, the Log Parser tool from Microsoft can be used to read and analyze IIS logs. Download Log Parser 2.2

ASP.NET Core 5 Design Patterns: Thinking code using architectural principles, testing, design patterns, and C

HTTPERR Logs

You should be able to locate your request in IIS logs but in case even after enabling your IIS logs your request is not present in IIS logs then there is a possibility that the request never reached IIS so you need to also look in HTTPERR logs. Any incoming request to the webserver is first handled by HTTP.SYS before being routed to the IIS worker process. Some requests are rejected by HTTP.SYS before being passed to an IIS worker process for handling. This generally happens in case of errors like Bad Request (400), connection timeouts, service unavailable (503), and many more. Here is the complete list of HTTP.SYS error codes.

HTTPERR logs help to Analyze ASP.NET Application Issues by providing details of an error at the request level which helps in identifying issues at each request level.

HTTPERR logs can be found on path C:\Windows\System32\LogFiles\HTTPERR

Windows Event Logs

Request in IIS logs with status 500 i.e. Internal server error is mostly related to unhandled ASP.NET Application errors. If configured properly and if there are no compatibility issues with the health monitoring feature then, in that case, there are chances that error details might have been logged to the windows event log. Health Monitoring will log all errors to the application event log. Specifically, look for warning events from the source “ASP.NET “. One point to note here is that errors written to EventLog are limited i.e. it will only log one error per minute.

Also, it will be helpful to scan event logs around the error time to get some insights if there are any other errors/warnings related to Windows/Disk/CPU/Memory which might be causing an error in the Application.

Failed Request Tracing

This will help you capture a detailed request trace for a specific URL, status code or time-taken. Will provide details to determine what is happening with request and why, provided the problem can be simulated. Problems that are random in nature are difficult to troubleshoot unless you are able to capture trace when the problem occurs.

Request trace is very detailed and sometimes it might take lots of time to analyze a single request.

Display ASP.NET Exception

Analyze ASP.NET Application Issues

On a temporary basis, you can enable your application to display a complete exception in the browser to identify the exact cause of the problem.

For this, we can need to add a customErrors tag within the web.config configuration file located in the root directory of the application. The <customErrors> tag should have its mode attribute set to off. ‘off’ Specifies that custom errors are disabled & detailed ASP.NET errors are shown to the remote clients and to the localhost.

<customErrors defaultRedirect="url" mode="On|Off|RemoteOnly">
    <error. . ./>
</customErrors>

Remember that this setting i.e. custom errors should always be set to mode ‘on’ & should be enabled for debugging purposes only.

Newsletter Subscription

Stay updated! Instantly get notified about my new articles in your mailbox by subscribing via email

DebugDiag for Crash/Hang, Memory & Performance Analysis

To Analyze ASP.NET Application Issues DebugDiag can be used. DebugDiag is a free tool from Microsoft with capability that allows us to collect & analyze memory dump files. Dumps can be generated in 2 ways i.e. conditional or on-demand collections of memory dump files using configurable rules that trigger the collection.

DebugDiag download link: https://www.microsoft.com/en-us/download/details.aspx?id=58210

To a collect memory dump file on-demand

  • Run the DebugDiag 2.3 Collection tool.
  • Go to the Processes tab, Identify the process (e.g. using process ID) which needs to be analyzed.
  • Right-click on the required process and select the Create Full Userdump option from Menu.

To analyze the memory dump file

  • Run DebugDiag Analysis tool
  • Click add data files and add dump files which need to be analyzed.
  • Under analysis select type of analysis required and click start analysis.
  • It will generate a Report (mht file) that can be reviewed for details.

Conclusion

We reviewed various techniques to analyze asp.net application issues & these techniques have personally helped me to resolve many ASP.NET web application related issues. DebugDiag has been a great help to identify issues such as the hang process.

https://procodeguide.com/programming/top-12-essential-asp-net-core-libraries/
Hope you found this article useful. Your support is appreciated!
Buy me a coffeeBuy me a coffee
Home 9 Programming 9 Analyze ASP.NET Application Issues with Accuracy

Set start URL in ASP.NET Core – Quick & Easy ways

This article will cover the ways to set start URL in ASP.NET Core 5 applications i.e. change the default URL (http://localhost:5000) in ASP.NET Core applications. When you create any new ASP.NET Core application whether its MVC App or Web API and run it then it will...

Hangfire in ASP.NET Core – Easy way to Schedule Background Jobs

This article covers detail about how to integrate Hangfire in ASP.NET Core applications which is an easy way to schedule background jobs in .NET Core and .NET based applications. Background jobs or tasks allow the programmers to execute code on a different thread but...

How to Send Emails in ASP.NET Core – Quick & Easy Guide

These days sending emails like user email id confirmation, OTP emails, acknowledgments, etc. is a very common requirement of any application. In this article, we will see a demo about how to send emails in ASP.NET Core in quick & easy steps. We will create an...

ML.NET – Machine Learning with .NET Core – Beginner’s Guide

This article will get you started with the fundamentals of Machine Learning and how to get started with Machine Learning with .NET Core i.e. ML.NET. We will even learn different concepts of Machine learning with a brief overview. Introduction to Machine Learning...

Implement Cookie Authentication in ASP.NET Core – Detailed Guide

This article will get you started with implementing cookie authentication in ASP.NET Core applications. Cookie authentication allows you to have your own login/register screens & custom logic for user-id/password validation without the need to use ASP.NET Core...

ASP.NET Core Identity Roles based Authorization

This article will get you started with what are ASP.NET Core Identity roles and the need for roles, how to enable ASP.NET Core Identity roles in MVC Application, and how to implement role-based authorization. Role-based authorization is for basic authorization where...

Dependency Injection in ASP.NET Core 3.1 – Beginner’s Guide

This article will cover in details dependency injection in ASP.NET Core 3.1. ASP.NET Core is designed from the ground up to support the dependency injection design pattern. Dependency injection in ASP.NET Core provides a technique to create applications that are...

Real-time Web Applications with SignalR in ASP.NET Core 3.1

In this article, we will learn about real-time web & how to build real-time web applications using SignalR in ASP.NET Core. As part of this article, we will work on an application that can send real-time messages/alerts to all connected users or private messages...

Code Profiling using MiniProfiler in ASP.NET Core 3.1

This article will get you started with how to enable miniprofiler in ASP.NET Core to measure the performance of your application. MiniProlifer helps you understand how your application is performing by allowing you to profile any part of code in ASP.NET Core...

Microservices with ASP.NET Core 3.1

Microservices is a type of Architecture in which application is created as multiple small independent serviceable components. This article will cover in detail how to create microservices with ASP.NET Core, Serilog, Swagger UI, Health Checks & Docker containers....

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *