Strange error occurring when using wcf to run query against sql server
I am building an asp.net application, using II6 on windows server 2003 (vps hosting). I am confronted with an error I didn't receive on my development machine (windows 7, iis 7.5, 64 bit).
When my wcf service tries launching my query running against a local sql server this is the error I receive:
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 minFreeMemoryPercentageToActivat开发者_如何学GoeService on the serviceHostingEnvironment config element.
and ideas??
In your web.config, in your configuration\system.serviceModel\serviceHostingEnvironment element, add a minFreeMemoryPercentageToActivateService attribute, and set it to something lower than 5, I set mine to 0, and this error went away for me.
ex:
<configuration>
<system.serviceModel>
<serviceHostingEnvironment ... minFreeMemoryPercentageToActivateService="0" />
</system.serviceModel>
</configuration>
Caution via MSDN: "Specifying this attribute along with partial trust in the web.config file of a WCF service will result in a SecurityException when the service is run."
One thing you could try is changing your 'mex' service path to absolute if it is not already. It worked for me once. But that could have been due to the service restarting and freeing some memory.
BrainSlug's Answer has an example of how to do this
I encountered this issue when I was running my WCF service locally (localhost). I stopped the service. Closed few apps to clean my ram. and restarted it again. It started normally as earlier.
BrainSlug's Answer also worked. +1 for that. :)
Cheers!!
精彩评论