WCF通过IIS问题IP地址
问题描述:
我在双工协议上做了一个WCF服务。 它工作正常,没问题。但我只有一个小问题:WCF通过IIS问题IP地址
这里是我在哪里可以启动它的测试IP字符串: http://localhost:5659/Service.svc
但是,当我选择我的本地计算机上我的真实IP地址(其中,本地存在): http://93.4.18.3:5659/Service.svc
我还不能确定。另外我无法使用我的真实IP地址从其他地址连接。 可能是我的web.config中出现错误?
顺便说一句 - 我的防火墙,如果关闭。
这里是我的配置:
<extensions>
<bindingElementExtensions>
<add name="pollingDuplex" type="System.ServiceModel.Configuration.PollingDuplexElement, System.ServiceModel.PollingDuplex" />
</bindingElementExtensions>
</extensions>
<behaviors>
<serviceBehaviors>
<behavior name="GameStreamServiceBehavior">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentSessions="2147483647" />
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="pollingDuplexBinding">
<binaryMessageEncoding />
<pollingDuplex maxPendingSessions="2147483647" maxPendingMessagesPerSession="2147483647" inactivityTimeout="02:00:00" serverPollTimeout="00:05:00" />
<httpTransport />
</binding>
</customBinding>
</bindings>
<services>
<service name="WcfServer.Service" behaviorConfiguration="GameStreamServiceBehavior">
<endpoint address="" binding="customBinding" bindingConfiguration="pollingDuplexBinding" contract="WcfServer.IService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
答
您应该检查IIS中的站点绑定。端口5659上的HTTP绑定可能仅针对特定主机头(“localhost”)或特定IP地址(而非93.4.18.3)进行配置。这将解释你得到的行为。
如何在IIS中配置该站点的HTTP绑定? – mthierba 2011-05-10 19:50:44
这是所有带有配置的文件。我应该在哪里找到HTTP绑定? – alerya 2011-05-10 20:40:48
在IIS管理器中:右键单击托管此服务的站点,选择“编辑绑定...”,然后查看它对HTTP的说明,尤其是“IP地址”列。 – mthierba 2011-05-10 21:42:14