How toncrease Memory Allocated to IIS .NET Application

iis-7memorywindows-server-2008

We are using Windows 2008 R2 and IIS 7 running on Amazon EC2. IIS is running a single .NET application written in C#.

We are having performance issues and I want to give the application more memory, but I cannot figure out how to do it. How do I control the amount of memory that the CLR gets?

I'm a total newbie with IIS, .NET and the CLR. If I were working with Java, I would just use the -Xmx flag to increase the memory available to the JVM (e.g., -Xmx3000m for 3GB). But, I cannot seem to figure out how to do this in the Windows world.

Best Answer

The CLR hosted in the application pool for the web application will grab as much memory as necessary and then based on memory demand, use garbage collection as needed to free up memory.

You can put limits on the amount of memory accessible to an application pool (in the UI, via the Advanced Settings dialog, or via PowerShell and the WebAdministration module).

You might want to check if there are caps already set for the memory on the application pool, but there really isn't a way to dedicate more memory directly to an app pool without editing the machine.config for the .NET version the app runs under.

EDIT: The default autoconfiguration for memory caps in IIS 7 is 60 percent of the machines RAM. This can be manually increased by editing the machine.config file for the .NET version that your application runs under. Details of the various configuration settings here.