Issue with IIS application pool memory limit in Azure (.NET Blazor)

Ivan Brnelić 0 Reputation points
2025-02-19T19:10:52.9766667+00:00

I have a Blazor application deployed on an IIS application pool running on an Azure server. However, I'm facing an issue with a memory leak, and while I'm working on fixing it, I want to limit the RAM usage of the application process for now.

The problem is that when I set a private memory limit for the application pool, the pool keeps recycling. The application starts to crash and the pool is recycled as soon as the memory usage exceeds 1 GB, even though I’ve set the private memory limit to values like 10 GB or even 100 GB. Despite the high memory limit, the application pool keeps recycling when the memory usage reaches around 1-2 GB.

I've also tried adjusting the virtual memory settings, but the issue persists. It seems like the pool is recycling at around 1 GB regardless of the memory limit I set, almost like the limit is being reset constantly. The application works fine when the memory limit is set to 0, but as soon as I set any limit, it causes the pool to recycle.

Has anyone encountered a similar issue? Any suggestions on how to fix this problem or any known causes for this behavior?

Azure
Azure
A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.
1,089 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Suwarna S Kale 786 Reputation points
    2025-02-19T19:40:57.75+00:00

    Hello Ivan Brnelić,

    Thank you for posting your question in the Microsoft Q&A forum.

    The issue you are encountering with the IIS application pool recycling when setting a private memory limit is a common challenge, especially when dealing with memory leaks in applications like Blazor.

    When you set a private memory limit for an IIS application pool, the pool is designed to recycle when the memory usage exceeds the specified limit. However, in your case, the pool is recycling at around 1-2 GB, even though you’ve set the limit much higher (e.g., 10 GB or 100 GB). This suggests that something is overriding or interfering with the memory limit configuration.

    The issue of the IIS application pool recycling prematurely when a private memory limit is set is likely due to a combination of factors, including configuration overrides, system-wide limits, or the memory leak in your Blazor application. Please refer below documentation to verify the configurations:

    While you work on resolving the memory leak, you can try the following workaround:

    • Set the Private Memory Limit to 0 (unlimited) to prevent recycling.
    • Use Performance Monitor to track memory usage and manually recycle the application pool when memory usage becomes excessive.

    If the above answer helped, please do not forget to "Accept Answer" as this may help other community members to refer the info if facing a similar issue.

    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.