3

I am trying to upload zip files to a asp.net server. Its working fine on my local box when I run the server from VS but not for larger zips remotely. Remotely I am running IIS6.

It works great both remotely and locally on zips smaller than about 10mb and has been for months. 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:

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

The error I am getting remotely is that Request.Files is length 0.

Any idea on this or the best way to debug?

Luke Belbina
  • 5,708
  • 12
  • 52
  • 75

2 Answers2

0

I would highly recommend using Darren's asp.net upload/download control. Uploading large files in asp.net is a pain.

sarvesh
  • 2,743
  • 1
  • 20
  • 30
  • I am uploading from an automated environment in a C# application. – Luke Belbina Apr 06 '11 at 23:33
  • Yes don't know what I was thinking. Let me edit the answer. The problem is not matter what your maxRequestLength is IIS should still be able to accept in the first place before it you can gain access to the uploaded file in asp.net. My guess is IIS is not able to handle the file. – sarvesh Apr 06 '11 at 23:45
0

Webclient is a wrapper for HttpWebRequest. and I recommend to user HttpWebRequestinstead.

as you cant override timeout on webclient.

i faced the same issue. and now I'm using HttpWebRequest. much much better.

Arrabi
  • 3,718
  • 4
  • 26
  • 38
  • turns out it was an issue with Webclient as you said. I used the info here to fix it: http://stackoverflow.com/questions/1634470/webclient-uploadfile-errors – Luke Belbina May 17 '11 at 18:50