System.Net.WebException:

Discussion in 'ASP .Net' started by =?Utf-8?B?em9sb2Y=?=, May 9, 2006.

  1. 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 ?
    =?Utf-8?B?em9sb2Y=?=, May 9, 2006
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > 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 ?
    >
    Kevin Spencer, May 9, 2006
    #2
    1. Advertising

  3. That's great. Thanks a lot for your help.
    =?Utf-8?B?em9sb2Y=?=, May 9, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    2,795
    Kevin Spencer
    Sep 30, 2005
  2. Sean Erwin
    Replies:
    1
    Views:
    3,435
    Feroze [MSFT]
    Jan 2, 2004
  3. Steven Cheng[MSFT]
    Replies:
    4
    Views:
    1,651
    Steven Cheng[MSFT]
    Apr 8, 2004
  4. Skeptical
    Replies:
    1
    Views:
    6,572
    Scott Allen
    May 20, 2005
  5. Lisa Ngo
    Replies:
    3
    Views:
    440
    Jan Tielens
    Jan 18, 2004
Loading...

Share This Page