Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > System.Net.WebException:

Reply
Thread Tools

System.Net.WebException:

 
 
=?Utf-8?B?em9sb2Y=?=
Guest
Posts: n/a
 
      05-09-2006
Hi,
I am trying to make a simple file updload WinForm app.
Here's the code:
WebClient webClient = new WebClient();
webClient.UploadFile(new Uri("http://localhost/WebSite/Upload.aspx"),
"c:\\bin.zip");

My IIS 5.1 Web server uses default configuration.
If the file is less than 5Mo everything works fine. If the file is too big I
get this exception:
System.Net.WebException: The underlying connection was closed: An unexpected
error occurred on a receive. ---> System.IO.IOException: Unable to read data
from the transport connection: An existing connection was forcibly closed by
the remote host. ---> System.Net.Sockets.SocketException: An existing
connection was forcibly closed by the remote host

I will never have to upload more than 30Mo.
Do you now how I can correct this issue ?

 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      05-09-2006
In the web.config file, the httpRunTime element has a maxRequestLength which
restricts the length in bytes of any HTTP request. The default is 4MB.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"zolof" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
> I am trying to make a simple file updload WinForm app.
> Here's the code:
> WebClient webClient = new WebClient();
> webClient.UploadFile(new Uri("http://localhost/WebSite/Upload.aspx"),
> "c:\\bin.zip");
>
> My IIS 5.1 Web server uses default configuration.
> If the file is less than 5Mo everything works fine. If the file is too big
> I
> get this exception:
> System.Net.WebException: The underlying connection was closed: An
> unexpected
> error occurred on a receive. ---> System.IO.IOException: Unable to read
> data
> from the transport connection: An existing connection was forcibly closed
> by
> the remote host. ---> System.Net.Sockets.SocketException: An existing
> connection was forcibly closed by the remote host
>
> I will never have to upload more than 30Mo.
> Do you now how I can correct this issue ?
>



 
Reply With Quote
 
 
 
 
=?Utf-8?B?em9sb2Y=?=
Guest
Posts: n/a
 
      05-09-2006
That's great. Thanks a lot for your help.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments