c# - operation inconsistency between .net 3.0 and .net 4.5 DownloadFileAsync -
following code:
webclient client = new webclient(); client.downloadprogresschanged += downloadprogresschanged; client.downloadfilecompleted += downloadfilecompleted; client.downloadfileasync(new uri(downloadurl), downloadpath); works fine in .net 4.5 - downloads file without issues, in .net 3.0 or 3.5 doesn't work - file shows 0kb.
would know why discrepancy? wondering whether there additional headers missing 3.0 4.5 has included?
it doesn't throw errors.
update:
eventually throws "the operation has timed out." exception.
update #2:
i changed https http , seems have worked in particular case. in actual fact, http call redirected https. however, going directly https has not worked me .net 3.0.
default timeout might different depending on framework version. case binding configurations in web.config files suspect case here well.
i suggest create derived webclient class , override getwebrequest method set custom timeout suggested in thread: https://stackoverflow.com/a/3052637/2046539 inspired blog post: http://w3ka.blogspot.be/2009/12/how-to-fix-webclient-timeout-issue.html
as general rule: never trust default values. should use own values. of time default values not documented , implementation detail.
Comments
Post a Comment