Silverlight的WCF +异常:期待应用程序/肥皂+ XML,接收到的文本/ XML [英] Silverlight+WCF exception: Expecting application/soap+xml, received text/xml

查看:176
本文介绍了Silverlight的WCF +异常:期待应用程序/肥皂+ XML,接收到的文本/ XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Silverlight应用程序中,我想调用WCF服务。当调用服务,我收到来自服务器的响应如下:

I have a Silverlight application in which I would like to call a WCF service. When calling the service I receive the following response from the server:

415无法处理邮件,因为内容类型文本/ xml的;字符集= UTF-8是不是预期的类型应用程序/肥皂+ XML;字符集= UTF-8

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

有没有人遇到过这个问题?有谁知道我需要调整哪些配置设置?关于如何解决这一问题将是AP preciated的任何信息。

Has anyone experienced this problem before? Does anyone know which configuration settings I need to adjust? Any information on how to fix this would be appreciated.

推荐答案

那么,你可以尝试使用启用Silverlight WCF服务模板VS2008,并比较不同之处?我希望你需要使用 basicHttpBinding的,并使用一些更奇特的。

Well, you could try using the "Silverlight-enabled WCF Service" template in VS2008, and comparing the differences? I expect that you need to use the basicHttpBinding and are using something more exotic.

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

For info, here is the web.config section for a default Silverlight/WCF service:

 <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>

这篇关于Silverlight的WCF +异常:期待应用程序/肥皂+ XML,接收到的文本/ XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆