【发布时间】:2014-01-07 13:54:29
【问题描述】:
我在从 ASP.NET 应用程序访问 Web 服务时遇到了这个问题。
但是当它托管在 Windows 服务器中时会出现问题。
当它托管在桌面上时,它工作正常。
我正在使用 HttpWebRequest 对象调用 Web 服务。
即使它在 HTML/Java Script 应用程序的服务器中也能正常工作。仅在服务器中托管的 ASP.NET 应用程序中出现问题。我收到以下错误。 IIS 8.0 已安装在服务器中。
Unable to connect to the remote server
System.Net.Sockets.SocketException (0x80004005): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 153.2.228.76:443 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) at System.Net.HttpWebRequest.GetRequestStream() at VSPTestApplication.UPS.CalculateRate_Click(Object sender, EventArgs e)
System.IO.Stream GetRequestStream(System.Net.TransportContext ByRef)
【问题讨论】:
-
欢迎来到 SO。通过托管在您的桌面上,您的意思是作为服务客户端的 ASP.NET 应用程序和服务运行在同一台机器上,即您的开发机器上?稍微细化您的问题,以更清楚地了解您正在排除故障的情况与有效的情况。
-
非常感谢您的回复。它只是一个 ASP.NET 应用程序。我的意思是当它托管在安装在我桌面上的 IIS 中时,它工作正常。但是我在安装在 Windows 服务器中的 IIS 中托管相同的应用程序,然后它无法正常工作。
-
如果当您收到错误时,作为服务客户端的 ASP.NET 应用程序和服务位于不同的机器上,那么您需要对从客户端机器到托管服务的远程机器的连接进行故障排除。简单 - 例如网络浏览器,
telnet等。 -
它不是服务客户端,它只是一个 ASP.NET 应用程序。从带有 HTML/Java 脚本应用程序的 Web 浏览器测试连接性很好。当 ASP.NET 应用程序托管在 Windows 服务器的 IIS 中时,它无法在 ASP.NET 应用程序中运行。
标签: asp.net web-services httpwebrequest httpwebresponse