WCF,客户端无法连接,除非在同一台机器上

时间:2009-11-13 18:08:20

标签: wcf connectivity

我有一个简单的ASP.NET Web应用程序,它使用WCF客户端与简单的WCF支持的Windows服务进行通信。

在当地环境中一切正常。我们部署到dev,它也运行良好。但是在DEV上 - Web服务器和App服务器在同一台机器上。

现在我们已经部署到QA,我们得到'套接字连接已中止。 '立即抛出异常。 出于某种原因,我们的QA Web服务器无法通过我们的WCF客户端/服务与我们的QA应用服务器通信。 我可以从Web服务器ping QA app服务器 我可以从Web服务器远程登录QA app服务器 我可以从Web服务器连接到QA应用服务器上的HTTP WSDL

AND,我可以从我的LOCAL环境/ visual studio将FINE连接到我的QA服务!

那么为什么我的QA ASP.NET应用程序无法与我的QA WCF Windows服务通信?我已经尝试过并且尽可能地,但仍然没有去......

这是我在客户端上的System.ServiceModel部分:

<system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="BigFileBinding">
          <!-- required to receive files greater then default size of 16kb -->
          <readerQuotas maxArrayLength="5242880"/>
        </binding>
      </netTcpBinding>
    </bindings>
    <client>
      <endpoint address="net.tcp://NJQACNET01:58887/PriceService"
          binding="netTcpBinding"
          contract="IPriceService"
          bindingConfiguration="BigFileBinding"/>
      </endpoint>
    </client>
  </system.serviceModel>

这是我在服务上的system.servicemodel部分:

<system.serviceModel>
    <bindings>
      <netTcpBinding>
        <!-- required to receive files greater then default size of 16kb -->
        <binding name="BigFileBinding"
                 maxReceivedMessageSize="5242880">
          <readerQuotas maxArrayLength="5242880"/>
        </binding>
      </netTcpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="MetaDataBehavior" name="RK.Pricing.PricingPortal.MarketableSecuritiesService.PriceService">
        <endpoint address="net.tcp://localhost:58887/PriceService" binding="netTcpBinding"
          contract="RK.Pricing.PricingPortal.MarketableSecuritiesService.IPriceService" bindingConfiguration="BigFileBinding"   />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"  />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:58889/PriceService" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MetaDataBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

非常感谢您的帮助!非常感谢..

2 个答案:

答案 0 :(得分:1)

这可能是防火墙问题,您正在使用的端口在ASP.Net QA服务器和WCF QA服务器之间被阻止。

您可以使用telnet命令对此进行测试。

答案 1 :(得分:1)

我认为这可能是一个安全问题。请记住,默认情况下,NetTcpBinding使用Windows身份验证。

如果可能,您应该查看并遵循发布的指南here