I have a WCF Service running fine on my local machine. I put it on the servers, and I am receiving the following error:
An error occurred while receiving the HTTP response to http://xx.xx.x.xx:8200/Services/WCFClient.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.]
I have gone to the service in the url and it is working correctly. All I am doing for the function is returning a string to an image name, so the data being passed isn't a lot. I have traced the log and it gives me the same information. Here is my client config:
<binding name="basicHttpBinding_IWCFClient" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<endpoint name="basicHttpBinding_IWCFClient"
address="http://localhost:4295/Services/WCFClient.svc"
binding="basicHttpBinding"
bindingConfiguration="basicHttpBinding_IWCFClient"
behaviorConfiguration="WCFGraphicManagementTool.Services.ClientBehavior"
contract="WCFClient.IWCFClient" />
Here is my server config:
<service behaviorConfiguration="WCFGraphicManagementTool.Services.WCFClientBehavior"
name="WCFGraphicManagementTool.Services.WCFClient">
<endpoint name="basicHttpBinding_IWCFClient"
address=""
binding="basicHttpBinding"
contract="WCFGraphicManagementTool.Contracts.IWCFClient" />
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
<behavior name="WCFGraphicManagementTool.Services.WCFClientBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceThrottling maxConcurrentCalls="120" maxConcurrentSessions="120"
maxConcurrentInstances="120" />
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
Would it be a setting on the server since it works on my local machine?
I've had this same error and the problem was serialization. I managed to find the real problem using Service Trace Viewer http://msdn.microsoft.com/en-us/library/ms732023.aspx and solved it easy. Maybe this will help someone.
I had this problem because I configured my WCF Service to return a System.Data.DataTable.
It worked fine in my test HTML page, but blew up when I put this in my Windows Form application.
I had to go in and change the Service's Operational Contract signature from DataTable to DataSet and return the data accordingly.
If you have this problem, you may want to add an additional Operational Contract to your Service so you do not have to worry about breaking code that rely on existing Services.
This could be due to many reasons; below are few of those:
If your data contract objects use inheritance, make sure all base classes has the DataContract and DataMember attributes. Also, you need to have the base classes specify the derived classes with the [KnownType(typeof(BaseClassType))] attribute ( check out more info here on this).
Make sure all your data contract object properties have both get and set properties.
I think the best way to solve this is to follow the error advice, hence looking for server logs. To enable logs I added
Then you go to c:\logs\TracesServ_ce.svclog open it with microsoft service trace viewer. And see what the problem really is.
This error can be because of contract mismatch. Consider the three layered application below...
UI Layer
|
Process Layer
|
Data Access Layer
-> Contract Between Process and UI layer has the same enum with missing (Onhold = 3). Enum: Start = 1, Stop = 2. -> Contract Between Data Access And Process layer has enum Enum: Start = 1,Stop = 2,Onhold = 3.
In this case we will get the same error in process layer response.
The same error comes in other contract mismatch in multilayered application.
To fix this, we had to changed the AppPool Identity to an administrator account.