IIS Server error because of the current total memory

How to solve this error ultimately?


Server Error in '/****StatWCF_OData' Application.

Memory gates checking failed because the free memory (373817344 bytes) is less than 5% of total memory.  As a result, the service will not be available for incoming requests.  To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InsufficientMemoryException: Memory gates checking failed because the free memory (373817344 bytes) is less than 5% of total memory.  As a result, the service will not be available for incoming requests.  To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InsufficientMemoryException: Memory gates checking failed because the free memory (373817344 bytes) is less than 5% of total memory.  As a result, the service will not be available for incoming requests.  To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.]
   System.ServiceModel.Activation.ServiceMemoryGates.Check(Int32 minFreeMemoryPercentage, Boolean throwOnLowMemory, UInt64& availableMemoryBytes) +121924
   System.ServiceModel.HostingManager.CheckMemoryCloseIdleServices(EventTraceActivity eventTraceActivity) +86
   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +883

[ServiceActivationException: The service '/****StatWCF_OData/OData.svc' cannot be activated due to an exception during compilation.  The exception message is: Memory gates checking failed because the free memory (373817344 bytes) is less than 5% of total memory.  As a result, the service will not be available for incoming requests.  To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element..]
   System.Runtime.AsyncResult.End(IAsyncResult result) +650220
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +210733
   System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +282

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929


Solution is written in your post.

To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.

The easiest way just add this into your web.config

<system.serviceModel> 
    <serviceHostingEnvironment minFreeMemoryPercentageToActivateService="0" />
</system.serviceModel> 

Read more about serviceHostingEnvironment here.

Anyway how @Mr Grok correctly pointed it is an indication that your machine doesn't have enough physical memory and you should figure out why is this happening. It can be a serious problem.

WCF service with Full Memory Error (Memory gates checking failed , Server Error in '/****StatWCF_OData' Application. Memory gates checking failed because the free memory (373817344 bytes) is less than 5% of total memory. If you migrate applications to IIS 6.0 while the server is in worker process isolation mode, and if your applications previously ran in-process (in Inetinfo.exe) as LocalSystem, the applications may fail to access resources because of the restrictions set forth by the Network Service identity.


I had this problem. Turns out SQL server was using over 29 gb of my available 32 gb.

Check your SQL Server if you have one. MS SQL Sever is designed to take up as much free space as you allow it. You can limit this in the maximum server memory box in the property tabs of the SQL Server.

Too much memory usage of IIS application pool : The Official , Memory gates checking failed because the free memory (1398493184 bytes) is less than 5% of total memory. As a result, the service will not be  Memory gates checking failed because the free memory (373817344 bytes) is less than 5% of total memory. As a result, the service will not be available for incoming requests. To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.


I added serviceHostingEnvironment attribute to 0 in web.config.

<system.serviceModel> 
    <serviceHostingEnvironment minFreeMemoryPercentageToActivateService="0" />
</system.serviceModel>

This is the sipmplest way i found of doing this.

Article: The free memory is less than 5% of total memory in Sitefinity, My Windows Server is running an web application on IIS 7.5. IIS randomly generates the error message and it's a critical problem. Description: An unhandled exception occurred during the execution of the current web request. failed because the free memory (373817344 bytes) is less than 5% of total  Memory gates checking failed because the free memory (373817344 bytes) is less than 5% of total memory. As a result, the service will not be available for incoming requests. To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.


Well I had the same issue and I was looking for the solution. Most of the blogs were suggesting the same solution to add 'serviceHostingEnvironment' attribute in the web.config which is risky job as adding an attribute will effect entire IIS and it's hosted solutions and will restart IIS ultimately.

As error message was related to 'Memory storage issue' and we were asked to reduce the load on the server so what I did is just restarted SQL Server (MSSQLSERVER) service through service manager and everything gets back to normal and I got rid of the memory issue.

Window + R > services.msc > Restart Below Highlighted Service

Memory gates checking failed because the free memory , Sitefinity issues a popup box with the following error: Memory gates checking failed because the free memory (xxxxxx bytes) is less than 5% of total memory. As a result, the service will not be available for incoming requests. However, the cache memory usage might increase because older, less frequently accessed entries can remain in the cache. Setting the period too low causes more frequent scavenger scans, and it can result in too many flushes and cache churn. Request and connection management settings. In Windows Server 2016, HTTP.sys manages connections


The web.config worked for me, but also the SQL Server memory was an issue that needed addressed.

I was able to resolve the sql server memory issue without restarting the MSSQL server processes simply by reducing the server properties memory Maximum server memory to a lower value. The default was the effectively unlimited.

Without a MS SQL Service restart, the process automatically started reducing the memory footprint to the configured value.

SharePoint requests fail when memory is low, because the free memory (373817344 bytes) is less than 5% of total memory. Login to the machine hosting the IIS server. "Failed to create the template" error when using the Excel Template Current value is 'Service'. Memory gates checking failed because the free memory (43732992 bytes) is less than 5% of total memory. As a result, the service will not be available for incoming requests. To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.


Adobe ColdFusion Web Application Construction Kit: ColdFusion 10 , Well I can't because physical memory on the VM host is not limitless and I can create it was failing with error "The server could not complete your request. the total memory, "Memory gate checking" at the IIS level kicks in and causes Note: Simply add the setting to the current line separated by a space. This is why you need to monitor it via IIS’s status and not just look for w3wp.exe to be running on your server. Recommended Performance Counters for IIS Monitoring One of the advantages of using IIS as a web server is all of the metrics available via Windows Performance Counters.


Microsoft IIS 7 Implementation and Administration, threads: 150 Current thread count: 4 Current thread busy: 1 Max processing time: 279876 Request count: 748 Error count: 3 Bytes received: 281578 Bytes sent: 7375153 Free memory: 120128728 Total memory: external web server such as IIS or Apache may have request logging enabled there for all files of  By extending it, you can create a stable, flexible, and effective Windows IIS server. How to Set Up an IIS Server. Whether you install IIS on Windows 7, 8, or 10, the setup process is the same. Because IIS is a Windows feature, there isn’t much installation involved with setting it up. It’s really a matter of enabling it.


InfoWorld, Active Server Pages Provides counters for ASP applications on a system. Time counter is quite revealing because it can help you understand server load. You can check overall application performance and potential error indicators such as tells you about the network connection but the state of server memory as well. Guidelines for Resolving IIS Permissions Problems. 06/08/2017; 5 minutes to read; In this article. BizTalk Server makes extensive use of Microsoft Internet Information Services (IIS) for Web services support and for use with the HTTP, SOAP, and Windows SharePoint Services adapters.