【问题标题】:How to configure WCF service endpoint for a third party client如何为第三方客户端配置 WCF 服务端点
【发布时间】:2013-10-01 10:11:55
【问题描述】:

我在 VS 2010 中开发了 WCF 服务 (3.5)。通常我可以通过 WCF 测试客户端对其进行测试,并从任何浏览器调用该服务。我在我的 Windows 7 开发机器上,所以一切都是默认的。地址如http://localhost:54538/MyService.svc

但是,当我尝试从第三方客户端(最终是我的目标)调用服务时,客户端根本没有得到任何响应。响应只是空。我还尝试通过 PHP curl 从本地 Apache 网络服务器调用该服务 - 也是一个空响应。

所以我认为配置可能有问题。 服务部分是:

<services>
  <service behaviorConfiguration="MyNamespace.Service1Behavior" name="MyNamespace.MyService">
      <endpoint address="" binding="wsHttpBinding" contract="MyNamespace.IMyService">
          <identity>
              <dns value="localhost" />
          </identity>
      </endpoint>
      <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>

我是否必须添加端点或更改其他任何内容?

【问题讨论】:

  • 使用 WCF 测试客户端表示 SOAP 服务,而从任何浏览器调用该服务将表示 REST 服务 (webHttpBinding)。 ....

标签: wcf service endpoint


【解决方案1】:

所以我找到的解决方案(基于@marc_s 的评论)是添加另一个端点作为 webHttpBinding:

<endpoint address="rest" binding="webHttpBinding" contract="MyNamespace.IMyCometService" bindingConfiguration="UnsecuredWeb">
    <identity>
        <dns value="localhost"/>
    </identity>
</endpoint>

然后通过http://localhost:54538/MyService.svc/rest从第三方软件调用服务

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-12
    • 2012-02-07
    • 2012-09-20
    • 1970-01-01
    • 2011-10-13
    • 2011-07-01
    相关资源
    最近更新 更多