WCF通过IIS问题IP地址
我在双工协议上创建了一个 WCF 服务。 它工作正常且正常。但我只有一个小问题:
这是一个 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>
I made a WCF Service on Duplex Protocol.
It's works correctly and fine. But I have only one small problem:
here is a IP string where can I start an test it:
http://localhost:5659/Service.svc
But when I choose my real IP address on my local machine (where localhost existed):
http://93.4.18.3:5659/Service.svc
I can't connet yet. Also I can't connect from other addresses using my real IP address.
May be something wrong in my web.config ?
Btw - my firewall if switched off.
Here is my 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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该检查 IIS 中的站点绑定。端口 5659 上的 HTTP 绑定可能仅配置为特定主机头(“localhost”)或特定 IP 地址(不是 93.4.18.3)。这可以解释你所得到的行为。
You should check the Site bindings in IIS. It is possible that the HTTP binding on port 5659 is configured for a specific host header ("localhost") or a specific IP address (not 93.4.18.3) only. That would explain the behavior you're getting.