Click here to Skip to main content
15,887,477 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am getting below error while calling my WCF service from

The content type text/html; charset=UTF-8 of the response message does not match the content type of the binding (application/soap+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: '#content{ FONT-SIZE: 0.7em; PADDING-BOTTOM: 2em; MARGIN-LEFT: 30px}BODY{MARGIN-TOP: 0px; MARGIN-LEFT: 0px; COLOR: #000000; FONT-FAMILY: Verdana; BACKGROUND-COLOR: white}P{MARGIN-TOP: 0px; MARGIN-BOTTOM: 12px; COLOR: #000000; FONT-FAMILY: Verdana}PRE{BORDER-RIGHT: #f0f0e0 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #f0f0e0 1px solid; MARGIN-TOP: -5px; PADDING-LEFT: 5px; FONT-SIZE: 1.2em; PADDING-BOTTOM: 5px; BORDER-LEFT: #f0f0e0 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #f0f0e0 1px solid; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e5e5cc}.heading1{MARGIN-TOP: 0px; PADDING-LEFT: 15px; FONT-WEIGHT: normal; FONT-SIZE: 26px; MARGIN-BOTTOM: 0px; PADDING-BOTTOM: 3px; MARGIN-LEFT: -30px; WIDTH: 100%; COLOR: #ffffff; PADDING-TOP: 10px; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #003366}.intro{MARGIN-LEFT: -15px}<title>MyService Service<DIV id="c'.

Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory`1 factory, WebException responseException, ChannelBinding channelBinding)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

We are using Windows server 2003 for hosting WCF service.

Tried solution provided on below links:

https://forums.asp.net/t/2021425.aspx?Content+type+text+xml+vs+application+soap+xml+issue

But I couldn't find below options in windows server 2003.

To install the WCF non-HTTP activation components
1. Click the Start button, and then click Control Panel.
2. Click Programs, and then click Programs and Features.
3. On the Tasks menu, click Turn Windows features on or off.
4. Find the .NET Framework 3.0 node, select and then expand it.

any help would be really appreciated...

What I have tried:

Content type (text/xml vs application/soap+xml) issue | The ASP.NET Forums[^]

Jahith's Tech Sharing: The content type text/html; charset=utf-8 of the response message does not match[^]

We also took same code from production server along with all configuration and deployed it on QA server (having same OS configuration) and it was working. But it doesn't work on production server.
Posted
Updated 14-Jun-17 23:07pm
v2

1 solution

Add the following code to the web.config server project

    <system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="basicHttpBinding_IService">
      <security mode="Transport">
        <transport clientCredentialType="None" proxyCredentialType="None"/>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<services>
  <service name="Service">
    <endpoint address="" name="BasicHttpBinding_IService"
              binding="basicHttpBinding"
              bindingConfiguration="basicHttpBinding_IService"
              contract="IService" />
  </service>
 </services>
</system.serviceModel>


then update client web service,After the update, the following changes are made web.config

    
<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IService">
      <security mode="Transport" />
    </binding>
  </basicHttpBinding>
</bindings>


  <endpoint address="https://www.mywebsite.com/Service.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
    contract="Service.IService" name="BasicHttpBinding_IService" />


I hope to be useful
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900