System.Net.WebException:

G

Guest

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 ?
 
K

Kevin Spencer

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top