如何为第三方客户端配置WCF服务端点

时间:2013-10-01 10:11:56

标签: wcf service endpoint

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

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

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

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

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

1 个答案:

答案 0 :(得分:0)

所以我找到的解决方案(基于@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

从第三方软件调用该服务
相关问题