简体   繁体   中英

wcf + The content type text/html of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8)

I'm facing the below error " The content type text/html 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 514 bytes of the response were" . below is my bindings and config file

  <customBinding>
                <binding name="LoginServiceSoap12Binding">
                    <textMessageEncoding messageVersion="Soap12" />
                    <httpsTransport />
                </binding>
            </customBinding>

<endpoint address="WCF URL"
             binding="customBinding" bindingConfiguration="LoginServiceSoap12Binding"
             contract="CWALoginService.LoginServicePortType" name="LoginServiceHttpsSoap12Endpoint" />

What is issue not sure i'm facing here...

It most of the time means that your host returns an error page (because the content type is text/html as stated) instead of your service returning the response in application/soap+xml .

You should check if your service can be activated successfully by going in the url of your service ( http(s)://localhost{:port}/{subSite}/(WCF URL).svc ). If your service can be activated, than the next thing you should try is enabling the wcf tracing in both your client and service side by following:

  • Right click your web.config/app.config and click Edit WCF Configuration
  • Under Diagnostics section, enable Log Auto Flush , MessageLogging and Tracing and of course specify a path which your host identity has access to write.
  • Check the trace file after you execute that service call. Then you should see the html returned by your host and figure out what the real problem is.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM