471,325 Members | 1,704 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,325 software developers and data experts.

WebRequest - large files - timeout problem.

Hi

I am trying to upload a 700 mb file using webrequest/response model.
At 3x% I am getting the same error:

"Unable to write data to the transport connection: an established
connection was aborted by the software in your host machine"

CLIENT side script is:

req = WebRequest.Create(
req.Method = "POST";

//Headers
req.ContentType = "multipart/form-data";
req.ContentLength = fileSize;
req.Headers.Add("Name", file.Name);
req.Headers.Add("Path", path);
req.Headers.Add("SessionID", session);
req.Timeout = int.MaxValue;

Stream stream = req.GetRequestStream();

using (BinaryWriter writer = new BinaryWriter(stream))
{
FileStream fs = new FileStream(file.FullName,
FileMode.Open);

using (BinaryReader reader = new BinaryReader(fs))
{
int i = 0;
long total = 0;

byte[] buffer = new byte[32768];

while (((i = reader.Read(buffer, 0,
buffer.Length)) 0) && !Stop)
{
writer.Write(buffer, 0, i);
total += i;
uploadWorker.ReportProgress((int)(total *
100 / fileSize));
}
}
}

SERVER side script is:

Stream inputStream = HttpContext.Current.Request.InputStream;

using (BinaryReader reader = new
BinaryReader(inputStream))
{
FileStream fs = new FileStream(fullfile,
FileMode.Create);

using (BinaryWriter writer = new
BinaryWriter(fs))
{
int i = 0;
byte[] buffer = new byte[32768];

while ((i = reader.Read(buffer, 0,
buffer.Length)) 0)
{
writer.Write(buffer, 0, i);
}
}
}

Server has <httpRuntime maxRequestLength="102400" /in its config
file.

Would be grateful for help.
Kind Regards
PK
Aug 5 '08 #1
2 4231
Piotrekk said:
I am trying to upload a 700 mb file using webrequest/response model.
At 3x% I am getting the same error:

"Unable to write data to the transport connection: an established
connection was aborted by the software in your host machine"
Server has <httpRuntime maxRequestLength="102400" /in its config
file.
Increase that value. It represents the maximum data amount that can be
uploaded in kB. Your maximum therefore is 100MB which doesn't quite
cover your 700mb ;)

Cheers,
Udo
Aug 5 '08 #2
I think you should find another way to upload such a big file, IIRC
the maximum size for ASPNET is like 100MB
Aug 5 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Ryan Hartman | last post: by
6 posts views Thread by Ramesh | last post: by
17 posts views Thread by jensen bredal | last post: by
6 posts views Thread by Russell Stevens | last post: by
2 posts views Thread by WSE with SSL and large amount of data | last post: by
1 post views Thread by Steven Berkovitz | last post: by
17 posts views Thread by byte8bits | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.