【问题标题】:Access WCF Service from another pc从另一台电脑访问 WCF 服务
【发布时间】:2011-09-10 13:18:26
【问题描述】:

我已经为此花费了好几个小时,但根本无法让它发挥作用。也许我对托管 WCF 服务并为其创建客户端的理解是不正确的。

我的网站添加了一个 WCF 服务,配置如下...

<system.serviceModel>

<bindings>
  <wsHttpBinding>
    <binding name="Binding1">
      <security mode="None">
        <transport clientCredentialType="None" />
        <message establishSecurityContext="false" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

    <behaviors>
        <serviceBehaviors>
            <behavior name="MyWCFWebApp.Service1Behavior">
                <serviceMetadata httpGetEnabled="true"/>
                <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>

    <services>
        <service behaviorConfiguration="MyWCFWebApp.Service1Behavior" name="MyWCFWebApp.Service1">
            <endpoint address="" binding="wsHttpBinding" contract="MyWCFWebApp.IService1" bindingConfiguration="Binding1">
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
        </service>
    </services>

</system.serviceModel>

当我使用内置 Web 服务器通过 Visual Studio 运行网站时,我可以通过 http://localhost:9988/Service1.svc 访问 Web 服务

但是……

通过cassiniDev Server托管网站时,绑定ip和主机名,我可以通过http://localhost:9988/Service1.svc访问wcf服务,但是当我尝试使用ip或主机名http://10.111.202.73:9988/Service1.svc访问wcf服务时,它返回以下错误:

“没有协议绑定与给定地址“http://10.111.202.73:9988/Service1.svc”匹配。协议绑定在 IIS 或 WAS 配置中的站点级别配置。”

我不知道为什么会这样。有什么想法吗?

【问题讨论】:

  • IP 10.111.202.73:9988 来自哪里?
  • 我的帖子有一些缺陷。我编辑了它。 10.111.202.73 是本地计算机尝试通过ip地址而不是localhost访问wcf服务的ip地址。它是运行 wcf 服务的同一台电脑。
  • 这似乎是 WCF 和 cassini 的一个错误 :( 没有可用的解决方案。ultidev.com/Forums/default.aspx?g=posts&t=351
  • 最好将服务器配置中的地址定义为 http://*:9988 而不是 localhost:9988,但我不知道这在这种情况下是否有帮助

标签: wcf cassini


【解决方案1】:

所以事实证明这个问题与不支持 WCF 3.5 的 cassinidev webservice 有关......我花了一段时间才弄清楚......

【讨论】:

    【解决方案2】:

    也许您可以尝试在控制台应用程序中托管您的服务,就像测试它是否与 IIS 相关。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-12-16
      • 1970-01-01
      • 2015-06-10
      • 2018-09-24
      • 2016-04-30
      • 1970-01-01
      • 2013-08-24
      • 1970-01-01
      相关资源
      最近更新 更多