by Raju Maharjan
18. June 2011 14:38
If you ever received the below error while accessing your WCF servcie, then it is most likely that your server is having very low free memory. In this case, one of the main reason could be some big application running on the server consuming most of the memory.
So best way to get rid of this problem could be increase the memory for your server. In the other hand, you may uninstall the undesired applications running at your server.
Server Error in 'yourdomain/app' Application.
Memory gates checking failed because the free memory (14618624 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 (14618624 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 (14618624 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) +51455 System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +604
[ServiceActivationException: The service '/staging/coresecurityservice/coresecurityservice.svc' cannot be activated due to an exception during compilation. The exception message is: Memory gates checking failed because the free memory (14618624 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) +679246 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +190 System.ServiceModel.Activation.ServiceHttpModule.EndProcessRequest(IAsyncResult ar) +300622 System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +8837348
|
You can also update your wcf configuration files for the required parameters and also set minFreeMemoryPercentageToActivateService in ServiceHostingEnvironment
<serviceHostingEnvironment>
aspNetCompatibilityEnabled="Boolean"
minFreeMemoryPercentageToActivateService="Integer"
<baseAddressPrefixFilters>
<add prefix="string"/>
</baseAddressPrefixFilters>
<transportConfigurationTypes>
<add name="String"
transportConfigurationType="String" />
</transportConfigurationTypes>
</serviceHostingEnvironment>
Set the minimum free memory percentage according to your needs:
minFreeMemoryPercentageToActivateService="1" //for minimum 1% of Free memeory
minFreeMemoryPercentageToActivateService is an integer that specifies the minimum amount of free memory that should be available to the system, before a WCF service can be activated.