WCF通过IIS问题IP地址

发布于 2024-11-06 09:58:07 字数 1879 浏览 0 评论 0原文

我在双工协议上创建了一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半透明的墙 2024-11-13 09:58:07

您应该检查 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文