Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

ajax

wcf

Ajax Call:

   $.ajax({
        type: "POST",
        url: "http://SomeService/ServiceName.svc/GetSearchResults",
        data: JSON.stringify({ parameters: serviceParameters }),
        contentType: "application/json; charset=utf-8",
        dataType: "XML",
        success: function (response) {
            $("#xmlText").text(response.xml);
        },
        error: function (msg) {
            alert(msg.toString);
        }
    })

WCF Interface:

[OperationContract]
        [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Xml, RequestFormat = WebMessageFormat.Json,
                    UriTemplate = "GetSearchResults")]
        XElement GetSearchResults(inputParameters parameters);

        [OperationContract]
        [WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, UriTemplate = "getFile")]
        Stream GetFile(DocInfo info);

Web.config:

 <system.web>
    <compilation debug="true" targetFramework="4.0" />
    <customErrors mode="Off"/>
  </system.web>

 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

 <system.serviceModel>
   <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true">
   </serviceHostingEnvironment>
   <standardEndpoints>
     <webHttpEndpoint>
       <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true"></standardEndpoint>
     </webHttpEndpoint>
   </standardEndpoints>
 </system.serviceModel>

The service is hosted on IIS6.

When I call the service I get the following error message:

500 System.ServiceModel.ServiceActivationException

I can call the GetFile method and get the response stream but I get the error message when calling GetSearchResults.

Any help will be appreciated.

like image 618
user1589967 Avatar asked Aug 10 '12 10:08

user1589967


1 Answers

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.

like image 151
Fahad Abid Janjua Avatar answered Oct 10 '22 04:10

Fahad Abid Janjua