The operation has timed out

Posted by np on Stack Overflow See other posts from Stack Overflow or by np
Published on 2010-03-10T15:50:57Z Indexed on 2010/04/19 23:03 UTC
Read the original article Hit count: 235

Filed under:

We shave this code which result in timeout when downlaoding the file programatically:

System.Net.WebClient Client = new System.Net.WebClient();
if (!File.Exists(fileName))
{
    Client.DownloadFile(downloadLink, fileName);
    HtFilesSuccessfullyDownloaded[fileName] = fileName;
    string SuccessfullyDownloadedFiles = Path.Combine(dirName, "SuccessfullyDownloadedFiles.txt");
    File.AppendAllText(SuccessfullyDownloadedFiles, Environment.NewLine + fileName);
}

It looks like when the files are large we are getting the timeout error when DownloadFile method is called. We have added the followign in web.config but it does not look like it helps:

 <httpRuntime maxRequestLength="1048576" executionTimeout="3600"
/>

Please let me know if you have any suggestions.

© Stack Overflow or respective owner

Related posts about c#