0

I have two asp.net mvc-4 and mvc-5 web applications deployed under iss-8. Now from the first asp.net MVC web application i am calling an action method on the second web application , using the following :-

using (WebClient wc = new WebClient())
                {

                    string url = currentURL + "Admin/scanserver";
                    var args = new NameValueCollection { { "FQDN", "allscan" } };
                    wc.Headers.Add("Authorization", token);
                    var json = await wc.UploadValuesTaskAsync(url, args);
                    TempData["messagePartial"] = string.Format("Scan completed");

                }

now the operation take around 25-30 minutes to complete. and when i am calling the above using a web browser, the browser keeps loading for around 25 minutes , then it will show a message that the Scan completed. so i have the following questions:-

  1. I read that the defualt timeout for the WebClient is 100 second,, but seems in my case the web client wait to receive the json for around 25 minutes, without raising any timeout...

  2. i am using async methods to call the action method ,, so will this affect the timeout period ?

  3. in the above example i am using wc.UploadValuesTaskAsync now let say i want to use wc.DownloadDateTaskAsync will this have different timeout ?

can anyone advice on my above 3 questions please?

Thanks

John John
  • 1
  • 72
  • 238
  • 501
  • 1
    1- Maybe you can force a timeout: http://stackoverflow.com/questions/4238345/asynchronously-wait-for-taskt-to-complete-with-timeout ....2 - Did you try with sync methods instead? .... 3 - http://stackoverflow.com/questions/4057926/why-does-webclient-downloadstringtaskasync-block-new-async-api-syntax-ctp – Hackerman Jun 24 '16 at 13:51
  • @Hackerman thanks for the reply,, but before forcing anything i need to understand the default behavior ,,, so by default will WebClient timeout ? and will using async or sync affect the timeout period ?? – John John Jun 24 '16 at 14:03

0 Answers0