簡體   English   中英

wcf +響應消息的內容類型text / html與綁定的內容類型不匹配(application / soap + xml; charset = utf-8)

[英]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)

我遇到以下錯誤“ 響應消息的內容類型text / html與綁定的內容類型不匹配(application / soap + xml; charset = utf-8)。如果使用自定義編碼器,請確保IsContentTypeSupported方法已正確實現。響應的前514個字節為” 以下是我的綁定和配置文件

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

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

什么是不確定我在這里面臨的問題...

多數情況下,這意味着您的主機返回錯誤頁面(因為內容類型為所述的text/html ),而不是您的服務在application/soap+xml返回響應。

您應該通過輸入服務的URL( http(s)://localhost{:port}/{subSite}/(WCF URL).svc )檢查服務是否可以成功激活。 如果您的服務可以被激活,那么接下來您應該嘗試的是通過以下步驟在客戶端和服務端啟用wcf跟蹤:

  • 右鍵單擊您的web.config / app.config,然后單擊“ Edit WCF Configuration
  • Diagnostics部分,啟用Log Auto FlushMessageLoggingTracing ,當然指定您的主機的身份訪問寫的路徑。
  • 執行該服務調用后,請檢查跟蹤文件。 然后,您應該查看主機返回的html並找出真正的問題是什么。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM