Click here to Skip to main content
11,481,916 members (65,884 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET3.5 C# ASP.NET file
Dear Experts,

I have a from that uploads files to data table(in session) and then after clicking on send button it calls a webservice dynamically and uploads the file to data base.

I've set the request length and etc for both application and webservice to 2GB:

 <httpRuntime executionTimeout="10000" maxRequestLength="2000000"/>

Every thing works fine until the file size reaches to 100MB

After that, the application returns me an exception:

Exception has been thrown by the target of an invocation.
InnerException: The underlying connection was closed: An unexpected error occurred on a send.

I've a custom exception on my webservice codes so I know it will never enter the codes of webservice.

I should add that the call web service dynamically is a dll that I used.... can anybody help me?

[edit] little typo and format[/edit]
[improve] I should add that the webservice and the Prosentation are on the same server, also I've checked this with UI on my local computer to call that webservice[/improve]
[improve2]I'm using .net 3.5[/improve2]
----------------------------
[improve 3] this is full error text
System.Net.WebException occurred
  Message="The underlying connection was closed: An unexpected error occurred on a send."
  Source="System.Web.Services"
  StackTrace:
       at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
       at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
       at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
       at NHTC.WA.DMS_Maroun.wsprojFileInsert.WSManageDMSProject.InsertFile(DataSet dsInput, String userName) in C:\NHTC_TFS_WorkSpace\OrganizationPortal\UI\DMS_Maroun\NHTC.WA.DMS_Maroun\NHTC.WA.DMS_Maroun\Web References\wsprojFileInsert\Reference.cs:line 2212
       at NHTC.WA.DMS_Maroun.iMultipleuploads_M.insertNewFiles() in C:\NHTC_TFS_WorkSpace\OrganizationPortal\UI\DMS_Maroun\NHTC.WA.DMS_Maroun\NHTC.WA.DMS_Maroun\iMultipleuploads_M.aspx.cs:line 302
  InnerException: System.IO.IOException
       Message="Unable to write data to the transport connection: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full."
       Source="System"
       StackTrace:
            at System.Net.Sockets.NetworkStream.MultipleWrite(BufferOffsetSize[] buffers)
            at System.Net.Connection.Write(ScatterGatherBuffers writeBuffer)
            at System.Net.ConnectStream.ResubmitWrite(ConnectStream oldStream, Boolean suppressWrite)
       InnerException: System.Net.Sockets.SocketException
            Message="An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full"
            Source="System"
            ErrorCode=10055
            NativeErrorCode=10055
            StackTrace:
                 at System.Net.Sockets.Socket.MultipleSend(BufferOffsetSize[] buffers, SocketFlags socketFlags)
                 at System.Net.Sockets.NetworkStream.MultipleWrite(BufferOffsetSize[] buffers)
            InnerException: 
[/improve]
Posted 23-Apr-12 22:42pm
Edited 24-Apr-12 0:55am
v6
Comments
s_mon at 24-Apr-12 4:00am
   
Lookin' forward to a suitable answer... I could also run into that.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Based on the error message: "The underlying connection was closed: An unexpected error occurred on a send.", it does not looks like a failure because of file size here. It sounds more like the connection got closed in between because of the time it takes to upload. See if these help:
You receive one or more error messages ...[^]
The underlying connection was closed...[^]
Solving "The underlying connection was closed...[^]
  Permalink  
Comments
ashkansiroos at 24-Apr-12 5:23am
   
But it only takes 1 sec to raise error and Also every thing works fine for a file with 98MB but when file size changed to 104MB it raise the error
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

<httpruntime executiontimeout="10000" maxrequestlength="2000000" />
Also this tag in client application which is using web service ..
  Permalink  
Comments
ashkansiroos at 24-Apr-12 8:45am
   
I've done it on both server and webservice...
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I've changed the call webservice method to normal web service calling and still the same error raised...
  Permalink  
Comments
Sandeep Mewara at 24-Apr-12 4:59am
   
Not an answer. Just an update to your question. You should use 'Improve Question' link and post such things.
ashkansiroos at 24-Apr-12 5:34am
   
sorry

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 24 Apr 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100