Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在没有超时异常的情况下下载大型xml文件_C#_.net_Winforms_Timeout_Webrequest - Fatal编程技术网

C# 如何在没有超时异常的情况下下载大型xml文件

C# 如何在没有超时异常的情况下下载大型xml文件,c#,.net,winforms,timeout,webrequest,C#,.net,Winforms,Timeout,Webrequest,您可以看到我的代码,我想下载一个带有webrequest的xml文件。我将时间设置为最大值。但我总是有例外。你有什么建议吗 WebRequest webRequest = WebRequest.Create("*******"); webRequest.Timeout = 999999999; WebResponse myWebResponse = webRequest.GetResponse(); 文件有多大?你等了277个小时@DGibbs我不知道,因为我不能用任何

您可以看到我的代码,我想下载一个带有webrequest的xml文件。我将时间设置为最大值。但我总是有例外。你有什么建议吗

    WebRequest webRequest = WebRequest.Create("*******");
    webRequest.Timeout = 999999999;
    WebResponse myWebResponse = webRequest.GetResponse();

文件有多大?你等了277个小时@DGibbs我不知道,因为我不能用任何浏览器下载它。询问另一端(下载XML文件的地方)它们的超时时间或最大请求长度是多少。即使您将超时设置为最大值,如果他们的超时为2分钟,或者他们的最大请求长度仅为1MB。web服务器配置很有可能会覆盖您的请求以获得更长的超时时间。检查web服务器的配置。