I am using web references in my app but I am getting following exception.
I have used bellow code.
obj
is my web reference object. It does not take obj
directly that is why I have used variable for that. But still it's not working, it takes me automatically to previous activity.
var url=obj.ToString();
// Create a new WebRequest Object to the mentioned URL.
WebRequest myWebRequest=WebRequest.Create(url);
Console.WriteLine("\nThe Timeout time of the request before setting is : {0} milliseconds",myWebRequest.Timeout);
// Set the 'Timeout' property in Milliseconds.
myWebRequest.Timeout=10000;
// This request will throw a WebException if it reaches the timeout limit before it is able to fetch the resource.
WebResponse myWebResponse=myWebRequest.GetResponse();
Unhandled Exception: System.Net.WebException: The request timed out
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in :0 at System.Net.HttpWebRequest.GetResponse () [0x00000] in :0 at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse (System.Net.WebRequest request) [0x00000] in :0
It hit your timeout, meaning it did not get a response from the URL it called in time.
Check the URL in a browser. Check if it returns anything and how long it takes.
Make sure you don't need to configure a proxy.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.