相关疑难解决方法(0)

响应消息的WCF charset = utf-8与绑定的内容类型不匹配(application/soap + xml; charset = utf-8)

我正在使用.NET 4.0在IIS 7.5中托管WCF服务.我还有一个WPF应用程序,我用作使用Visual Studio 2010和.NET 4.0构建的客户端.我添加了我的服务引用,当我尝试调用函数时,我得到以下异常

内容类型application/xml; 响应消息的charset = utf-8与绑定的内容类型不匹配(application/soap + xml; charset = utf-8)

我能够在Web浏览器中导航到该服务,并且我的绑定在客户端和服务之间看起来是相同的(WsHttp绑定).

我知道有很多关于此错误的谷歌搜索结果,但它们似乎都不相关/帮助我的具体问题.我尝试安装非HTTP激活功能以及各种其他小技巧.有人能帮忙吗?谢谢

编辑,这是我的配置(他们很长)

客户

<?xml version="1.0"?>
<configuration>
   <system.serviceModel>
      <bindings>
         <basicHttpBinding>
             <binding name="ContentSoap" 
                 closeTimeout="00:01:00" openTimeout="00:01:00"
                 receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
                 bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
                 maxBufferSize="2147483647" maxBufferPoolSize="2147483647" 
                 maxReceivedMessageSize="2147483647"
                 messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                 useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" 
                              maxArrayLength="2147483647"
                              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <security mode="None">
                    <transport clientCredentialType="None" proxyCredentialType="None"
                               realm="" />
                    <message clientCredentialType="UserName" algorithmSuite="Default" />
                </security>
             </binding>
             <binding name="OrderSoap" 
                 closeTimeout="00:01:00" openTimeout="00:01:00"
                 receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
                 bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                 maxBufferSize="65536" maxBufferPoolSize="524288" 
                 maxReceivedMessageSize="65536"
                 messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                 useDefaultWebProxy="true">
               <readerQuotas maxDepth="32" maxStringContentLength="8192" …
Run Code Online (Sandbox Code Playgroud)

wcf message types response

20
推荐指数
2
解决办法
7万
查看次数

内容类型text/html; charset =响应消息的UTF-8与绑定的内容类型不匹配(text/xml; charset = utf-8)

我创建了WCF服务并使用独立应用程序测试WCF客户端.我能够使用Internet Explorer查看此服务,也可以在Visual Studio服务引用中查看.这是错误消息.

"The content type text/html; charset=UTF-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8)."

你能不能指出可能出错的地方?

谢谢.

c# wcf web-services

13
推荐指数
1
解决办法
9万
查看次数

标签 统计

wcf ×2

c# ×1

message ×1

response ×1

types ×1

web-services ×1