Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.

and ideas??

like image 824
vondip Avatar asked May 21 '10 07:05

vondip


2 Answers

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."

like image 126
BrainSlugs83 Avatar answered Oct 21 '22 19:10

BrainSlugs83


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

like image 14
Daniel Dyson Avatar answered Oct 21 '22 19:10

Daniel Dyson