I'm testing out faults and exception handling on my service and am seeing odd results.
I have one service contract that has two endpoints configured. One is basicHttpBinding and the other is wsHttpBinding. Locally on my machine I have a test app client and server running. I can call both web service bindings successfully and get the exception I'm looking for on both, exactly what I'm looking for. But when I push my code out to the dev server I can only call the wsHttpBinding endpoint successfully. The basic endpoint returns an odd message. The exception is "The remote server returned an error: (500) Internal Server Error."
and the Exception Message is:
"The content type text/html of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: insert bunch of nonsense html here"
Is this a configuration error? An IIS error? A firewall issue? I've ran WCF logging and also tracing on the server. My code is being hit just fine and it's throwing a fault exception fine. The Message Header is empty on the basicHttpBinding but I'm not sure if that's a problem. I've checked the IIS logs as well. It shows the 500 errors but that's all. Is there anything else I should check?
My endpoints:
<endpoint
address=""
binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IEOIEligible_NONSSL"
name="IEOIEligible_Svc_endpoint_NONSSL"
contract="Engine.IEOIEligible">
</endpoint>
<endpoint
address="mex"
binding="mexHttpBinding"
name="Mex_Svc_endpoint"
contract="IMetadataExchange" />
<endpoint
address="/basic"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IEOIEligible"
name="basicEOIEndpoint"
contract="Engine.IEOIEligible" />
[Edit]
Binding configuration:
basicHttpBinding
<binding name="BasicHttpBinding_IEOIEligible" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="Certificate" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Certificate" algorithmSuite="Default" />
</security>
</binding>
wsHttpBinding
<binding name="WSHttpBinding_IEOIEligible_NONSSL" closeTimeout="00:10:00"
openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
maxBufferPoolSize="524288" maxReceivedMessageSize="524288" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="819200" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
</binding>
From the WCF trace file:
The successful call (wsHttp):
<ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/MessageTraceRecord">
<MessageProperties>
<Encoder>application/soap+xml; charset=utf-8</Encoder>
<AllowOutputBatching>False</AllowOutputBatching>
</MessageProperties>
<MessageHeaders>
<Action d4p1:mustUnderstand="1" xmlns:d4p1="http://www.w3.org/2003/05/soap-envelope" xmlns="http://www.w3.org/2005/08/addressing">http://tempuri.org/IEOIEligible/VerifyEOIRequiredEOIEligibilityFaultFault</Action>
<RelatesTo xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:5863c107-b721-4b4c-88b8-0d03c22175d1</RelatesTo>
<ActivityId CorrelationId="a498440c-2e5a-4298-9bc5-ade08d51933c" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">00000000-0000-0000-0000-000000000000</ActivityId>
</MessageHeaders>
</ExtendedData>
the server 500 (basicHttp)
<ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/MessageTraceRecord">
<MessageProperties>
<Encoder>text/xml; charset=utf-8</Encoder>
<AllowOutputBatching>False</AllowOutputBatching>
</MessageProperties>
<MessageHeaders></MessageHeaders>
</ExtendedData>
[Edit]
I am able to get a response from the service using the basicHttpBinding via the Microsoft WCF Test Client but that's only when I don't throw a FaultException on the server, meaning the service returned down the happy path. This part I'm not concerned with, thankfully.
I'm unit testing client exception handling and the server is returning a 500 on the basic but not the wsHttpBinding. The wsHttpBinding is returning the proper SOAP fault embedded within the soap body but the basic isn't. The Soap fault is returned with basicHttpBinding when ran locally just not from a true server.