求助,WCF 调用错误

songhuan 2009-01-13 10:04:05
本人有一个简单的WCF,宿主是IIS,在本地调用没有问题,但是放到远程服务器(E文)上,就出现如下错误:
The content type text/html;charset=gb2312 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly.


我在代码中进行了搜索,没有指定charset=gb2312的地方,我也不需要处理中文,只有英文,请教如何解决?
...全文
221 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
songhuan 2009-01-19
  • 打赏
  • 举报
回复
还是没有人回答吗? 等待高手
songhuan 2009-01-13
  • 打赏
  • 举报
回复
顶起来
songhuan 2009-01-13
  • 打赏
  • 举报
回复
这是我服务端的配置:
 <wsHttpBinding>
<binding name="WSHttpBinding_IMyService" maxReceivedMessageSize="2147483647" maxBufferPoolSize="524288" messageEncoding="Text" textEncoding="utf-8" >
<readerQuotas maxStringContentLength="2147483647" />
</binding>
</wsHttpBinding>

这是客户端的配置:
  <binding name="WSHttpBinding_IMyService2" closeTimeout="00:50:00"
openTimeout="00:50:00" receiveTimeout="00:50:00" sendTimeout="00:50:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false" >
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>

</binding>

请问能看出来问题吗?


回三楼:
搜索了
asdfg_ 2009-01-13
  • 打赏
  • 举报
回复
应该是编码的问题吧 搜索了隐藏代码吗
GTX280 2009-01-13
  • 打赏
  • 举报
回复
示例:

<binding name="BasicHttpBindingConfiguration" 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" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
GTX280 2009-01-13
  • 打赏
  • 举报
回复
修改服务器的Web.Config文件和客户端的Web.Config(或App.Config),Binding设置要一致

110,531

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧