• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 811
  • Last Modified:

asp.net file upload, getting timeouts on large file uploads II6 6.0

I have set maxrequestentity, modified the metabase.xml and turned off asp buffering and still getting a timeout at just over a minute...have no idea why!

IIS 6.0
Windows 2k3
web.config is as follows:
<?xml version="1.0" encoding="utf-8"?>
<httpRuntime executionTimeout="360000" maxRequestLength="2097151" useFullyQualifiedRedirectUrl="false" 
minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="10000" />

Open in new window

  • 5
1 Solution
bluedragon99Author Commented:
The request was aborted: The request was canceled.

WebException was unhandled, just over a minute everytime when trying to upload large files via .net code.
 Dim WebClient As New Net.WebClient
        Call WebClient.UploadFile("http://xxxxxx:xxx/xxx.aspx?filename=" & "test.dat", pathtolargefile)

Open in new window

bluedragon99Author Commented:
any way to turn on tracing/debugging to catch the prob on the webserver?
bluedragon99Author Commented:
appears that WebClient is timing out, can someone help me convert my uploader to a WebRequest?  doesnt seem to be placing the file on the IIS server...

            Dim rdr As New FileStream("C:\windows\system32\calc.exe", FileMode.Open)
            Dim req As HttpWebRequest = DirectCast(WebRequest.Create("http://xxx.xxxx.com:7601/newuppoint.aspx"), HttpWebRequest)
            req.Method = "POST"
            ' you might use "POST"
            req.ContentLength = rdr.Length
            req.AllowWriteStreamBuffering = True
            Dim reqStream As Stream = req.GetRequestStream()
            Dim inData As Byte() = New Byte(rdr.Length - 1) {}
            ' Get data from upload file to inData 
            Dim bytesRead As Integer = rdr.Read(inData, 0, rdr.Length)
            ' put data into request stream
            reqStream.Write(inData, 0, rdr.Length)
            ' after uploading close stream 

Open in new window

bluedragon99Author Commented:
Server reciever looks like..
<%@ Import Namespace="System"%>
<%@ Import Namespace="System.IO"%>
<%@ Import Namespace="System.Net"%>
<%@ Import NameSpace="System.Web"%>
<Script language="C#" runat=server>
void Page_Load(object sender, EventArgs e) {
   string guid = System.Guid.NewGuid().ToString("N").ToUpper();
   foreach(string f in Request.Files.AllKeys) {
       HttpPostedFile file = Request.Files[f];

Open in new window

bluedragon99Author Commented:
Was the fact that you can't set a timeout value on the WebClient object...used webrequest instead.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now