2009-04-27 143 views
1

連接我的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> 

我怎樣才能解決這個問題?

回答

1

嘗試修改此:

<serviceDebug includeExceptionDetailInFaults="false"/> 

這樣:

<serviceDebug includeExceptionDetailInFaults="true"/> 

,看看是否在錯誤的附加信息是有幫助的(也添加信息後)。

0

這聽起來像你得到一個ASP.NET錯誤頁(a.k.a「T 他黃屏死亡中」)調用WCF服務,這可以解釋爲什麼響應的MIME類型是text/html的時候。
您是否在IIS中託管您的服務?

在啓用例如Andrew建議的異常詳細信息之後,您可以複製從服務返回的異常消息的內容,該消息將是一個很長的HTML字符串,將其粘貼到新的文本文件中,並將其另存爲。 HTML並在Web瀏覽器中打開它以查看錯誤詳細信息。