简体   繁体   English

ASP.Net文件上传最大尺寸? 暂停?

[英]ASP.Net File Upload Max Size? Timeout?

I am trying to upload zip files to a asp.net server. 我正在尝试将zip文件上传到asp.net服务器。 Its working fine on my local box when I run the server from VS but not for larger zips remotely. 当我从VS运行服务器而不是远程更大的拉链时,它在我的本地机箱上正常工作。 Remotely I am running IIS6. 远程我正在运行IIS6。

It works great both remotely and locally on zips smaller than about 10mb and has been for months. 它在小于大约10mb的拉链上远程和本地都可以很好地工作并且已经持续了好几个月。 Only recently have I needed anything larger. 直到最近我还需要更大的东西。

Here is my code for uploading: 这是我的上传代码:

        WebClient client = new WebClient();
        client.UploadProgressChanged += onProgress;
        client.UploadFileCompleted += onComplete;
        client.UploadFileAsync(new Uri(url), filePath);
        return client;

My code for receiving is: 我的接收代码是:

        Request.Files[0].SaveAs(pathToSave);

My web.config looks like: 我的web.config看起来像:

<httpRuntime maxRequestLength="102400" useFullyQualifiedRedirectUrl="true" executionTimeout="5400"/>

The error I am getting remotely is that Request.Files is length 0. 我远程获取的错误是Request.Files的长度为0。

Any idea on this or the best way to debug? 有没有想过这个或最好的调试方法?

I would highly recommend using Darren's asp.net upload/download control . 我强烈推荐使用Darren的asp.net上传/下载控件 Uploading large files in asp.net is a pain. 在asp.net上传大文件是一件痛苦的事。

Webclient is a wrapper for HttpWebRequest. Webclient是HttpWebRequest的包装器。 and I recommend to user HttpWebRequestinstead. 我建议用户HttpWebRequestinstead。

as you cant override timeout on webclient. 因为你无法覆盖webclient上的超时。

i faced the same issue. 我遇到了同样的问题。 and now I'm using HttpWebRequest. 现在我正在使用HttpWebRequest。 much much better. 好多了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM