Unable to get html response from source URL using WebClient

Jun 18 2014 1:45 AM
Hi,

My code is running perfectly well when I run my project through Visual Studio 2010.But when I configure the application on IIS 5 the code gives following exception:

Unable to connect to the remote server.

at System.Net.WebClient.UploadValues(Uri address, String method, NameValueCollection data)
at System.Net.WebClient.UploadValues(String address, String method, NameValueCollection data)
at _Default.RunCrawler(String source, String keyword, String fileType)

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 111.111.222.19: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).

Code
WebClient webclient = new WebClient();
byte[] responseArray = webclient.UploadValues("some source URL", "POST", values);
response = System.Text.Encoding.ASCII.GetString(responseArray);