Ajay
Ajay

Reputation: 6590

How to solve WCF error?

Why should I get this error

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: !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> < html xmlns="http://www.w3.org/1999/xhtml">

InnerException

The remote server returned an error: (500) Internal Server Error

Error Screenshot

Upvotes: 1

Views: 991

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038790

There could be multiple reasons why you are getting this error. From the information you provided in your question it is hard to say what could be the exact reason. In order to debug the problem you could configure tracing:

<system.diagnostics>
    <sources>
        <source name="System.ServiceModel"
                switchValue="Information, ActivityTracing"
                propagateActivity="true">
            <listeners>
                <add name="sdt"
                     type="System.Diagnostics.XmlWriterTraceListener"
                     initializeData= "WcfDetailTrace.xml" />
            </listeners>
        </source>
    </sources>
</system.diagnostics>

and then open the generated WcfDetailTrace.xml trace file with the provided SvcTraceViewer.exe and inspect the exception details.

Upvotes: 1

Related Questions