gpt4 book ai didi

.net - Silverlight+WCF 异常 : Expecting application/soap+xml, 收到文本/xml

转载 作者:行者123 更新时间:2023-12-04 00:53:51 26 4
gpt4 key购买 nike

我有一个 Silverlight 应用程序,我想在其中调用 WCF 服务。调用服务时,我从服务器收到以下响应:

415 Cannot process the message because the content type 'text/xml; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8



有没有人遇到过这个问题?有谁知道我需要调整哪些配置设置?任何有关如何解决此问题的信息将不胜感激。

最佳答案

那么,您可以尝试使用VS2008中的“启用Silverlight的WCF服务”模板,并比较差异?我希望您需要使用 basicHttpBinding 并且正在使用更奇特的东西。

有关信息,这里是默认 Silverlight/WCF 服务的 web.config 部分:

 <system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MySite.Service1Behavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service behaviorConfiguration="MySite.Service1Behavior"
name="MySite.Service1">
<endpoint address="" binding="basicHttpBinding"
contract="MySite.Service1" />
<endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>

关于.net - Silverlight+WCF 异常 : Expecting application/soap+xml, 收到文本/xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/493883/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com