【发布时间】: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,但我不知道这在这种情况下是否有帮助