WCF,客户端无法连接,除非在同一台机器上
我有一个简单的 ASP.NET Web 应用程序,它使用 WCF 客户端与简单的 WCF 支持的 Windows 服务进行通信。
在本地环境中一切都运行良好。我们部署到开发组,效果也很好。但是在 DEV 上 - Web 服务器和应用程序服务器位于同一台计算机上。
现在我们已经部署到 QA,我们得到“套接字连接已中止”。 ' 立即抛出异常。 由于某种原因,我们的 QA Web 服务器无法通过 WCF 客户端/服务与我们的 QA 应用程序服务器通信。 我可以从 Web 服务器 ping QA 应用程序服务器 我可以从 Web 服务器远程登录 QA 应用程序服务器 我可以从 Web 服务器连接到 QA 应用程序服务器上的 HTTP WSDL
,并且我可以从我的本地环境/视觉工作室将 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>
非常感谢您的帮助!非常感谢..
I have a simple ASP.NET web app which uses a WCF Client to talk to a simple WCF backed Windows Service.
All worked fine in local environments. We deployed to dev, which also worked fine. However on DEV - the Web server and App server are on the same machine.
Now that we have deployed to QA, we get the 'The socket connection was aborted. ' exception thrown immedately.
For some reason, our QA Web server cannot talk to our QA app server via our WCF client/service.
I can ping the QA app server from the web server
I can telnet the QA app server from the web server
I can connect to the HTTP WSDL on the QA app server from the web server
AND, I can connect FINE to my QA service from my LOCAL environment / visual studio !!!
So why can't my QA ASP.NET app talk to my QA WCF Windows service? I have tried and in every way possible, and still no go...
Here is my System.ServiceModel section on client:
<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>
Here is my system.servicemodel section on the service:
<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>
Thank you very much for any help! It is greatly appreciated..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这可能是防火墙问题,您使用的端口在 ASP.Net QA 服务器和 WCF QA 服务器之间被阻止。
您可以使用 telnet 命令对此进行测试。
This is probably a firewall problem, the port you are using is blocked between the ASP.Net QA server ans the WCF QA Server.
You can test this using the telnet command.
我认为这可能是一个安全问题。请记住,默认情况下,NetTcpBinding 使用 Windows 身份验证。
您应该查看并遵循发布的指南 此处(如果可能)。
I think this is likely a security problem. Keep in mind that by default, NetTcpBinding use Windows authentication.
You should review and follow the guidelines published here if possible.