How to allocate more memory to website on IIS?

  .net, asp.net, iis, windows, windows-server-2016

We have a .Net framework 4.8.2 based web application hosted on IIS 10. The OS is Windows Server 2016. This server and IIS are dedicated for this application and there are no other programs installed on this server. The allocated RAM for this VM server is 32 gigs.

This application has a backend application which is Web API based application hosted on different server. And these APIs are called for getting the data to be displayed on the UI for the web application. This data can go anywhere between empty string to 100 or sometimes 200 megabytes of JSON string. This string is then deserialized into .Net DataSet object and then displayed on the UI.

The issue for us is as soon as this JSON dataset string’s size goes beyond 20 megabytes, the application starts throwing System.OutOfMemory errors at random locations around this string variable. This exception happens even before it is converted to DataSet and just after it is retrieved from the API call, meaning the application is not able to handle this large string. At present due to the nature of this application we can also not break this resultset into further pieces as this is already broken down according to the UI requirements.

We did some research about this and found out that theoretically the size of the string can go upto 2 gigs but we are just around 20 megs and it starts throwing OOM. We checked the Task Manager around the time this application throws OOM and the memory consumed exactly at the time of the exception is around 25% of the available memory, which means application on IIS is starved of memory even when it is available to the server.

So now my question is –

  1. Does IIS have any cap on memory allowed for the application inside it? In other words does IIS have any maximum allowed memory configuration for the server that we can use for this application?
  2. Any other ways we can increase the allowed memory for this application?
  3. Any other things we can look into to solve this error?

Source: Windows Questions

LEAVE A COMMENT