WCF error when hosting on a remote machine - content type of the response does not match the content type of the binding RRS feed

  • Question

  • Hi,

    I have a WCF service which works perfectly when using SoapUI but throws error in my .Net client.

    {"The content type text/html; charset=UTF-8 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: '<HTML><HEAD><link rel=\"alternate\" type=\"text/xml\" href=\"http://xyz.mysite.com/ysa/Broker.svc?disco\"/><STYLE type=\"text/css\">#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}</STYLE><TITLE>Broker Service</TITLE></HEAD><BODY><DIV id=\"content\"><P class=\"head'."}

    I have the same service hosted on my local machine and when I point to the local service I can execute the operation with no issues. The message encoding is Soap11. I tried changing to Soap12 but I get exact same error. Any ideas greatly appreciated.


    Sofia Khatoon

    Sunday, October 12, 2014 4:22 PM

All replies

  • I got more information on this error message by removing truncate option in Fiddler.

    The response returned indicates the basic .svc page

    You have created a service.

    To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:

    The Fiddler call history shows the tunnel from http to https url and then getting the service page back. Now my question is why the service is returning the .svc page instead of executing the operation and returning the response.

    Sunday, October 12, 2014 9:21 PM
  • Hello Sofia,

    The client page that comes with the service can be used only to test the svc on local machine. to use it on a remote machine, you need to create proxies and use it. a basic sample is provided in the following link


    let us know if you need any help.



    Monday, October 13, 2014 10:01 AM
  • I did create the client using a service reference and I get the error when executing the client.
    Monday, October 13, 2014 12:38 PM