当我尝试从Webclient调用Rest服务时抛出以下异常。我只有在从其他WCF服务调用此Rest服务时才会获得此异常。如果我从控制台应用程序调用Rest服务,则不会抛出任何错误。
以下是例外情况 ..
{"Unable to connect to the remote server"}
[System.Net.WebException]: {"Unable to connect to the remote server"}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: null
InnerException: {"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 xxx.xxx.xx.xxx:443"}
Message: "Unable to connect to the remote server"
Source: "System"
StackTrace: " at System.Net.WebClient.UploadDataInternal(Uri address, String method, Byte[] data, WebRequest& request)\r\n at System.Net.WebClient.UploadString(Uri address, String method, String data)\r\n at System.Net.WebClient.UploadString(String address, String method, String data)\r\n at
TargetSite: {Byte[] UploadDataInternal(System.Uri, System.String, Byte[], System.Net.WebRequest ByRef)}
以下是内部例外详情:
{"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 xxx.xxx.xx.xxx:443"}
[System.Net.Sockets.SocketException]: {"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 xxx.xxx.xx.xxx:443"}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: null
InnerException: null
Message: "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 xxx.xxx.xx.xxx:443"
Source: "System"
StackTrace: " at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)\r\n at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)\r\n at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)"
TargetSite: {Void DoConnect(System.Net.EndPoint, System.Net.SocketAddress)}
感谢您解决此问题的各种帮助......