【问题标题】:WCF in WP7 The client and service bindings may be mismatchedWP7 中的 WCF 客户端和服务绑定可能不匹配
【发布时间】:2011-05-24 06:27:54
【问题描述】:

我在本地创建并测试了 WCF 服务,当然它工作正常。我发布到一个共享托管站点并浏览到 wsdl,看起来还不错。但是,当我在 WP7 代码中调用该服务时,我收到一条错误消息并显示无用的错误消息。启用 includeExceptionDetailInFaults 和 WCF 跟踪错误读取后。 “System.ServiceModel.ProtocolException:内容类型 application/soap+xml;charset=utf-8 已发送到需要 text/xml 的服务;charset=utf-8。客户端和服务绑定可能不匹配。”

这里是 web.config 的一部分...

<behaviors>
  <serviceBehaviors>
    <behavior name="SL_SeeYaThere_WCF.Web.SeeYaThereWCFBehavior">
     <serviceMetadata httpGetEnabled="true" />
     <serviceDebug httpHelpPageEnabled ="true" includeExceptionDetailInFaults="true"  />
    </behavior>
    <!—- other services… -->
  </serviceBehaviors>
</behaviors>

<bindings>
   <basicHttpBinding>
     <!—- there is not a binding for this service should there be? -->
     <!—- other services… -->
   </basicHttpBinding>
</bindings>





服务>

服务>

^^ 申请格式。编辑器无法正确显示标记。

这是我第一次使用 WFC,但并不愉快。我做错了什么?

感谢您的帮助。

【问题讨论】:

    标签: wcf-binding


    【解决方案1】:

    好的,找到问题了。在 WP7 应用程序中有一个 ServicesReferences.clientConfig 文件,其中包含客户端绑定。 WCF 服务有两个端点,一个用于本地主机,一个用于共享托管地址。当我从本地主机“配置服务引用”到共享主机站点时,一定发生了这种情况。

    我将本地主机地址更改为共享托管地址,它可以工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-18
      • 1970-01-01
      • 1970-01-01
      • 2023-03-21
      相关资源
      最近更新 更多