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.