![](/img/trans.png)
[英]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)
[英]Getting the error Client found response content type of 'text/html; charset=utf-8', but expected 'application/soap+xml'?
在我的本地計算機上,我打開了IIS,創建了虛擬目錄,構建了代碼並嘗試啟動網頁,但是出現以下錯誤-
“ System.InvalidOperationException:客戶端發現響應內容類型為'text / html; charset = utf-8',但預期為'application / soap + xml'”
誰能讓我知道如何糾正這個問題。 使用的平台是Windows 7,可與Visual Studio 2005,C#.NET一起使用。 我對此並不陌生,從未從事過這些工作。
請幫助我。 提前致謝。
似乎您正在使用SOAP1.1(使用de內容類型text / xml)而不是SOAP1.2(使用conte類型的application / soap + xml)。
在您的web.config中添加以下內容:
<system.web>
<webServices>
<protocols>
<add name="HttpSoap"/>
<add name="HttpSoap12"/>
</protocols>
</webServices>
</system.web>
它使您的Web服務接受SOAP1.1和SOAP1.2請求。
如果您在客戶端部分上工作,則必須為客戶端應用程序激活SOAP1.2協議。 沒有代碼和解釋就不能說了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.