How to diagnose, troubleshoot AppPool hangs with MVC ASP.NET 4.7 on IIS 10

Production IT 1 Reputation point
2022-01-05T14:08:34.767+00:00

I have a webapplication using MVC ASP.NET 4.7 on IIS10 (Windows Server 2019). The webapplication is reading data from an Oracle database using Oracle ManagedDataAccess dll and displaying it in a javascript chart library.
This webapplication is 'hanging' randomly. I mean, web requests to this website are not coming through on the client. Users see a white screen & loading icon in the browser navigation bar but don't get the webpage displayed. The worker process in IIS shows all requests queued at such a moment. The issue is only resovled by recycling the application pool.
I have looked in my code for potential issues, but have not found anything so far. The Windows application event log is not showing errors at these times.

What would be the best way to diagnose/troubleshoot this kind of issue to get to the root cause?. I have already re-created app-pool & IIS application, updated my application libraries, double checked Oracle stored procedure code, C# code for possible deadlocks...

Any help is greatly appreciated.

Internet Information Services
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,483 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
999 questions
{count} votes

5 answers

Sort by: Most helpful
  1. Jose Zero 576 Reputation points
    2022-01-05T15:10:53.607+00:00

    Since you have an Asp.Net webapplication, I suggest you implement Global.asax, and write some log ad Application_End event.
    major-events-in-global-asax-file
    global-asax-file-in-asp-net-mvc-tutorial-with-example
    aspnet-global-asax-events-methods

    Not sure you have an issue with Application Pool.
    I would start checking for long time of response between code and DB then possible issues at javascript.

    A easy way to "sniff" a suspect AppPool issue (when it happen) is access webapplication using another browser and see if it respond.
    Open another browser, because ASP.NET pipeline will not process requests belonging to the same session concurrently.

    When you Recycle AppPool you are just droping all current sessions.


  2. Bruce (SqlWork.com) 65,211 Reputation points
    2022-01-05T23:58:08.337+00:00
    0 comments No comments

  3. Production IT 1 Reputation point
    2022-01-07T11:55:57.903+00:00

    The cause was probably the use of static methods in the classes used for MVC, which was causing thread locks from time to time.

    0 comments No comments

  4. Bruce (SqlWork.com) 65,211 Reputation points
    2022-01-07T15:45:58.457+00:00

    static methods do not cause thread locks. static variables can cause consistency errors. improper use of semaphores, mutexs or other synconization is the typical cause

    0 comments No comments

  5. jaikant 0 Reputation points
    2023-04-15T10:12:28.9266667+00:00

    This issue could have multiple potential causes, so troubleshooting steps would depend on several factors, such as the application's complexity, the server's resources, the number of concurrent users, and the frequency of the issue. However, here are some general steps that you could take to troubleshoot the issue: Check the IIS logs: Review the IIS logs to see if there are any errors or warnings during the time when the web requests are hanging. Look for any patterns, such as specific URLs or user agents, that could help pinpoint the issue. Enable Debugging: Enable debugging in your application and set up a breakpoint on the first line of your code to check the stack trace when the issue occurs. This can help identify any exceptions or infinite loops. Monitor the server resources: Use Performance Monitor to monitor the server's resources, such as CPU, memory, and disk usage. Check for any unusual spikes or patterns during the time of the issue. Enable Failed Request Tracing: Enable Failed Request Tracing in IIS to capture detailed diagnostic information about failed requests. This can help pinpoint the issue by providing detailed information about each request's execution. Monitor the database: Monitor the database using Oracle's built-in tools, such as Enterprise Manager or SQL Developer, to check for any database performance issues, such as slow-running queries or blocking sessions. Review the code: Review the code for any potential issues, such as resource leaks, deadlocks, or infinite loops. Consider using code profiling tools, such as Visual Studio's Performance Profiler or JetBrains dotTrace, to identify performance bottlenecks. Consider Load Testing: Consider performing load testing on the application to simulate a high volume of requests and see how the application responds. This can help identify any scalability issues that could lead to the hanging requests. Check network connectivity: Review network connectivity between the application server and the Oracle database server. Check for any network congestion or latency that could be causing issues. By following these steps, you should be able to diagnose the root cause of the issue and take steps to address it. cng

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.