2012-12-19 83 views
1

我们有一个WCF服务作为Windows服务托管在我们的应用程序服务器上,并带有tcp绑定。我们有一个ASP.NET Web应用程序托管在试图连接到它的单独的Web服务器上。这两台服务器都是Windows 2008 R2机器。ASP.NET Web应用程序无法连接到作为Windows服务托管的WCF

ASP.NET Web应用程序的应用程序池被设置为使用ApplicationPoolIdentity作为其用户。当我们尝试连接到从Windows机器出现以下错误WCF服务:

Source Exception: System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ServiceModel.CommunicationException: The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:00:09.9980000'. ---> System.IO.IOException: The read operation failed, see inner exception. ---> System.ServiceModel.CommunicationException: The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:00:09.9980000'. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host 
    at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing) 

然而,当我们更改应用程序池的用户到网络服务它连接无误。

我的问题是两倍。有谁知道为什么使用ApplicationPoolIdentity不起作用,它是某种配置问题?而且,在网络服务帐户下运行应用程序池会有什么坏处?我知道ApplicationPoolIdentity拥有更少的权利,更安全,并被认为是最佳实践。

回答

0

答案取决于您在网络,服务器和服务中的不同配置。

我遇到过类似情况,ApplicationPoolIdentity没有权限与机器外部的资源进行通话。

另一个问题可能是如何处理Web应用程序和服务器之间的连接。您是否每次重复使用同一个连接,或者您是否关闭/重新打开频道? This msdn thread有一些这方面的信息。

+0

这是一个很好的观点,ASP.NET Web应用程序每次打开和关闭连接到WCF服务。这个特殊的功能不足以证明维持持久连接的合理性。看起来,ApplicationPoolIdentity没有权利与外部资源交流,就像在你的情况下一样。你能解决这个问题吗? – bwalk2895

+0

就我而言,这是一个阻止这种情况的域策略,所以我们切换到将应用程序池作为专用域帐户运行。不确定你的环境是什么样的,但检查防火墙配置。 –

+0

我们必须检查一下。感谢您的帮助。 – bwalk2895

相关问题