lundi 2 mars 2015

WCF http binding error: The content type text/html does not match the content type of the binding (text/xml; charset=utf-8)


Vote count:

0




I have a WPF client which consumes a WCF service. The client is accessing the service server via a VPN connection. At first initialisation, the client app catches an exception from the service:



There was a problem reaching the service.
The content type of 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 service is running without issue and this issue only appears when connecting via VPN, not from my Visual Studio development environment which is on the same domain as the service VM:


enter image description here


This exception only occurs on first initialisation, when I run the client app again, the issue is resolved & everything runs as expected. Here is my service app config:



<services>
<service name="IsesService.IsesService">
<endpoint address="" binding="basicHttpBinding" contract="IsesService.IIsesService" bindingConfiguration="basicHttp">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://EMEA-DIIS01v:8082"/>
</baseAddresses>
</host>
</service>
</services>

<behavior>
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True" />
<dataContractSerializer maxItemsInObjectGraph="2147483646" />
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>

<bindings>
<basicHttpBinding>
<binding name="basicHttp"
useDefaultWebProxy="false"
maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647"
maxBufferPoolSize="2147483647"
>
<readerQuotas maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxDepth="2147483647"
maxNameTableCharCount="2147483647"
maxStringContentLength="2147483647"/>
</binding>
</basicHttpBinding>
</bindings>


And client side:



<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IIsesService" useDefaultWebProxy="false"
maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647"
maxBufferPoolSize="2147483647">
<readerQuotas maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxDepth="2147483647"
maxNameTableCharCount="2147483647"
maxStringContentLength="2147483647"/>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://emea-diis01v:8082/" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IIsesService" contract="ServiceReference.IIsesService"
name="BasicHttpBinding_IIsesService" />
</client>
</system.serviceModel>


Am I missing something simple here?



asked 1 min ago







WCF http binding error: The content type text/html does not match the content type of the binding (text/xml; charset=utf-8)

Aucun commentaire:

Enregistrer un commentaire