Hi
I am donwloading a bunch of files donwlaoding from HTTPS server via modem. I was getting the following exception intermittently.
System.Net.WebException: The operation has timed out
at System.Net.WebClient.DownloadFile(Uri address, String fileName)
at ContentServer.CDownloadManager.download_from_server(String source, String usrName, String passWord, String destPath) in G:\Tests\Content_Server\Content_Server\DownloadManager.cs:line 125 8/27/2009 6:43:37 PM
sat_27-5_01.z Failed 8/27/2009 6:43:37 PM
The trace log for the above exception:
ystem.Net.Sockets Verbose: 0 : [3668] Exiting Socket#48377572::Receive() -> 284#284
System.Net.Sockets Verbose: 0 : [3668] Socket#48377572::Receive()
System.Net.Sockets Verbose: 0 : [3668] Data from Socket#48377572::Receive
System.Net.Sockets Verbose: 0 : [3668] 00000000 : 17 03 01 00 12 : .....
System.Net.Sockets Verbose: 0 : [3668] Exiting Socket#48377572::Receive() -> 5#5
System.Net.Sockets Verbose: 0 : [3668] Socket#48377572::Receive()
System.Net.Sockets Verbose: 0 : [3668] Data from Socket#48377572::Receive
System.Net.Sockets Verbose: 0 : [3668] 00000005 : B2 32 25 D4 6D F7 99 1A-31 E8 70 BB 9E FE 6D A7 : .2%.m...1.p...m.
System.Net.Sockets Verbose: 0 : [3668] 00000015 : DA 22 : ."
System.Net.Sockets Verbose: 0 : [3668] Exiting Socket#48377572::Receive() -> 18#18
System.Net.Sockets Verbose: 0 : [3668] Socket#48377572::Receive()
System.Net.Sockets Verbose: 0 : [3668] Data from Socket#48377572::Receive
System.Net.Sockets Verbose: 0 : [3668] 00000000 : 17 03 01 00 14 : .....
System.Net.Sockets Verbose: 0 : [3668] Exiting Socket#48377572::Receive() -> 5#5
System.Net.Sockets Verbose: 0 : [3668] Socket#48377572::Receive()
System.Net.Sockets Verbose: 0 : [3668] Data from Socket#48377572::Receive
System.Net.Sockets Verbose: 0 : [3668] 00000005 : 3C 81 6D 80 6F FB 2D 6E-4D BE 1B 9D 03 E0 1B 35 : <.m.o.-nM......5
System.Net.Sockets Verbose: 0 : [3668] 00000015 : 5D BC 2D B7 : ].-.
System.Net.Sockets Verbose: 0 : [3668] Exiting Socket#48377572::Receive() -> 20#20
System.Net.Sockets Verbose: 0 : [3668] Socket#48377572::Receive()
System.Net.Sockets Verbose: 0 : [3668] Data from Socket#48377572::Receive
System.Net.Sockets Verbose: 0 : [3668] 00000000 : 17 03 01 00 32 : ....2
System.Net.Sockets Verbose: 0 : [3668] Exiting Socket#48377572::Receive() -> 5#5
System.Net.Sockets Verbose: 0 : [3668] Socket#48377572::Receive()
System.Net.Sockets Verbose: 0 : [3668] Data from Socket#48377572::Receive
System.Net.Sockets Verbose: 0 : [3668] 00000005 : 6F 3A BF B1 81 45 7B 91-C5 13 3B E9 C1 52 C8 DB : o:...E{...;..R..
System.Net.Sockets Verbose: 0 : [3668] 00000015 : 08 33 64 05 42 38 95 8D-63 D4 15 52 4A 1F 8C 48 : .3d.B8..c..RJ..H
System.Net.Sockets Verbose: 0 : [3668] 00000025 : 63 9D 84 F6 61 05 E2 80-91 B2 E5 47 27 : c...a......G'
System.Net.Sockets Verbose: 0 : [3668] Exiting Socket#48377572::Receive() -> 45#45
System.Net.Sockets Verbose: 0 : [3668] Socket#48377572::Receive()
System.Net Verbose: 0 : [2204] HttpWebRequest#4418278::
Abort(The operation has timed out)
System.Net.Sockets Verbose: 0 : [2204] Socket#48377572::Dispose()
System.Net Error: 0 : [2204] Exception in the HttpWebRequest#4418278:: - The operation has timed out
System.Net.Sockets Error: 0 : [3668] Exception in the Socket#48377572::Receive -
A blocking operation was interrupted by a call to WSACancelBlockingCallSystem.Net.Sockets Verbose: 0 : [3668] Exiting Socket#48377572::Receive() -> 0#0
System.Net Verbose: 0 : [2204] Exiting HttpWebRequest#4418278::Abort()
System.Net Verbose: 0 : [3668] HttpWebRequest#4418278::Abort(The request was canceled)
System.Net Verbose: 0 : [3668] Exiting HttpWebRequest#4418278::Abort()
System.Net Error: 0 : [3668] Exception in the HttpWebRequest#4418278::EndGetResponse - The operation has timed out
System.Net Verbose: 0 : [3668] HttpWebRequest#4418278::Abort()
System.Net Verbose: 0 : [3668] Exiting HttpWebRequest#4418278::Abort()
My code is :
if
((uri.Scheme == Uri.UriSchemeHttp) || (uri.Scheme == Uri.UriSchemeHttps))
{
try
{
using (WebClient wc = new WebClient())
{
wc.Credentials =
new NetworkCredential(usrName, passWord);
wc.DownloadFile(uri, destPath);
}
return true;
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.NameResolutionFailure)
CFileManager.writeLog("Bad domain name");
else if (ex.Status == WebExceptionStatus.ProtocolError)
{
HttpWebResponse response = (HttpWebResponse)ex.Response;
CFileManager.writeLog(response.StatusDescription);
if (response.StatusCode == HttpStatusCode.NotFound)
CFileManager.writeLog("Not Found");
}
else
CFileManager.writeLog(ex.ToString());
return false;
}
}
Any help is highly appreciated.
Regards
Raju