500 System.ServiceModel.ServiceActivationException when making an Ajax call to WCF rest service 500 System.ServiceModel.ServiceActivationException when making an Ajax call to WCF rest service ajax ajax

500 System.ServiceModel.ServiceActivationException when making an Ajax call to WCF rest service


I encountered this error for the reason mentioned below

Memory gates checking failed because the free memory (258187264 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.


Many thanks for your inspired replies and comments.

I actually encountered the same error but with different story:

At first, I got "404 (Not Found)" server error, which is because I did not have a transport for "HTTPS" as well as I already have one for the "HTTP".

I added a <httpsTransport> to my <binding> element, so it looked like this:

<bindings>  <customBinding>    <binding name="CustomBinding_ITheService">      <httpTransport keepAliveEnabled="True" transferMode="Streamed" authenticationScheme="None" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" manualAddressing="true" />      <httpsTransport keepAliveEnabled="True" transferMode="Streamed" authenticationScheme="None" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" manualAddressing="true" />    </binding>  </customBinding></bindings>

Then I got the 500 System.ServiceModel.ServiceActivationException error. However, I navigated "Event Viewer > Windows Log > Application" and found that "transports cannot be defined more than a time for the same binding". So, I decided to add an additional endpoint with a new binding for the "HTTPS" transport.

At the end, my configuration looks like the following:

<services>  <service name="TheService" behaviorConfiguration="WebHttpBehavior_ITheService">    <endpoint binding="customBinding" bindingConfiguration="CustomBinding_ITheService" contract="ITheService" behaviorConfiguration="EndPointBehavior_ITheService" />    <endpoint binding="customBinding" bindingConfiguration="CustomBinding_ITheService_Secured" contract="ITheService" behaviorConfiguration="EndPointBehavior_ITheService" />  </service></services><bindings>  <customBinding>    <binding name="CustomBinding_ITheService">      <httpTransport keepAliveEnabled="True" transferMode="Streamed" authenticationScheme="None" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" manualAddressing="true" />    </binding>    <binding name="CustomBinding_ITheService_Secured">      <httpsTransport keepAliveEnabled="True" transferMode="Streamed" authenticationScheme="None" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" manualAddressing="true" />    </binding>  </customBinding></bindings>

Then every things goes the right way and works perfectly.

In case you develop on visual Studio and use IIS-Express "Cassini", remember to enable SSL option in the properties of the website-project, that tells IIS-Express to prepare a base URL for the HTTPS transport that you previously added to binding.


Add site bindingGo to the IIS => then Default Website=> right Click on that => Edit Bindings=> click on ADD Button=> add HTTPS bindings there

Details ARE in shown screenshot