WCF web服务错误

问题描述:

连接我的WCF服务时提供一个错误,WCF web服务错误

所述响应消息不匹配的结合(应用/肥皂+ XML的内容类型的内容类型text/html;字符集= UTF -8)低于这个

我的WCF服务配置文件:

<?xml version="1.0"?> 
<configuration> 
    <customErrors mode="Off"> 
    </customErrors> 
    <system.serviceModel> 
    <services> 
     <service name="WcfService1.Service1" behaviorConfiguration="WcfService1.Service1Behavior"> 
     <!-- Service Endpoints --> 
     <endpoint address="http://127.0.0.1/ChickenService/Service1.svc" binding="basicHttpBinding" contract="WcfService1.IService1"> 
      <identity> 
      <dns value="127.0.0.1"/> 
      </identity> 
     </endpoint> 
      <host> 
      <baseAddresses> 
      <add baseAddress="http://127.0.0.1/"/> 
      </baseAddresses> 
     </host> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="WcfService1.Service1Behavior"> 
     <serviceMetadata httpGetEnabled="true"/> 
      <serviceDebug includeExceptionDetailInFaults="false"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 
</configuration> 

我怎样才能解决这个问题?

尝试修改此:

<serviceDebug includeExceptionDetailInFaults="false"/> 

这样:

<serviceDebug includeExceptionDetailInFaults="true"/> 

,看看是否在错误的附加信息是有帮助的(也添加信息后)。

这听起来像你得到一个ASP.NET错误页(a.k.a“T 他黄屏死亡中”)调用WCF服务,这可以解释为什么响应的MIME类型是text/html的时候。
您是否在IIS中托管您的服务?

在启用例如Andrew建议的异常详细信息之后,您可以复制从服务返回的异常消息的内容,该消息将是一个很长的HTML字符串,将其粘贴到新的文本文件中,并将其另存为。 HTML并在Web浏览器中打开它以查看错误详细信息。