When working in virtual labs, I don't always adhere to best practices. For example, we all know the minimum memory recommendation for SharePoint is 16GB for production use. So, when testing in my labs, SharePoint web requests may fail. As a result, I find myself troubleshooting the issue, only to find the failure was caused by low memory. I have many SharePoint Farms and many VM's for testing, which covers all supported versions. So, one would think I have learned my lesson and simply provision all my virtual machines with at least 16GB's of memory. Well I can't because physical memory on the VM host is not limitless and I can create way more VM's if use less memory.
Mainly it's for me, so I can find the solution easily when this occurs again (and it will). However, I wanted to share my latest symptom which may help someone in the future.
Unable to access a SharePoint site with SharePoint Designer, it was failing with error "The server could not complete your request."
Example:
Clicking on "Details" provided no additional information.
Since I kind of spoiled it above, you already know its low memory. By default, when memory is below the 5% of the total memory, "Memory gate checking" at the IIS level kicks in and causes SharePoint failures.
If you think this issue is occurring, look in the application event logs during this failure, you may find the following event.
Log Name: Application
Source: System.ServiceModel 4.0.0.0
Date: 8/10/2018 2:30:15 PM
Event ID: 3
Task Category: WebHost
Level: Error
Keywords: Classic
User: contoso\spservice
Computer: sp
Description:
WebHost failed to process a request.
Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/56528276
Exception: System.ServiceModel.ServiceActivationException: The service '/b464bf6ac4fd49f986be1900c0ff4950/MetadataWebService.svc' cannot be activated due to an exception during compilation. The exception message is: Memory gates checking failed because the free memory (149831680 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.InsufficientMemoryException: Memory gates checking failed because the free memory (149831680 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.
at System.ServiceModel.Activation.ServiceMemoryGates.Check(Int32 minFreeMemoryPercentage, Boolean throwOnLowMemory, UInt64& availableMemoryBytes)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CheckMemoryCloseIdleServices(EventTraceActivity eventTraceActivity
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
--- End of inner exception stack trace ---
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath, EventTraceActivity eventTraceActivity)
Process Name: w3wp
Process ID: 2360
Disable Memory Checking from a Services Web Application:
To workaround this issue set the "minFreeMemoryPercentageToActivateService" to "0" in the web.config for the services web application (not the site), which effectively disables "Memory gate checking".
Example:
<system.serviceModel> <serviceHostingEnvironment minFreeMemoryPercentageToActivateService="0" /> </system.serviceModel>
Steps:
Add the "minFreeMemoryPercentageToActivateService" section previously described just above the "</configuration>" closing tag.
Example:
Disable Memory Checking from a Site Web Application:
If your site (not web services) is generating low memory errors, it is possible to disable memory checking at this level as well. However, the web.config may already have a "system.serviceModel" section, so you will need to add the "minFreeMemoryPercentageToActivateService" setting within the current section.
Example before the change:
<system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> </system.serviceModel>
Example after the change:
<system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" minFreeMemoryPercentageToActivateService="0"/> </system.serviceModel>
Note: Simply add the setting to the current line separated by a space.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.