当我使用 VS IDE 在代码下方运行时,它工作正常,但从 IIS 运行时出现异常
Dim strurl As String = "abc"
Dim myHttpWebRequest As HttpWebRequest = CType(WebRequest.Create("http://www.google.com/search?sourceid=navclient&gfns=1&q=" + strurl), HttpWebRequest)
我得到的例外是
例外
System.Net.WebException: Unable to connect to the remote server --->
System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 173.194.67.147:80 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, Int32 timeout, Exception& exception) --- End of inner exception stack trace --- at System.Net.HttpWebRequest.GetResponse()