将大文件上传到Webservice .net3.5时出现问题 [英] problem uploading large file to a webservice .net3.5

查看:95
本文介绍了将大文件上传到Webservice .net3.5时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尊敬的专家,

我有一个from可以将文件上传到数据表(在会话中),然后单击send按钮后,它会动态调用Web服务并将文件上传到数据库.

我已将应用程序和Web服务的请求长度等设置为2GB:

 <   httpRuntime     executionTimeout   ="     maxRequestLength   ="  / > 



一切正常,直到文件大小达到100MB

之后,应用程序向我返回异常:

调用的目标引发了异常.
InnerException:基础连接已关闭:发送时发生意外错误.



我的网络服务代码中有一个自定义例外,因此我知道它永远不会输入网络服务代码.

我应该补充一点,动态调用Web服务是我使用的dll....有人可以帮助我吗?

小错别字和格式[/edit]
[improve]我应该补充说,webservice和Prosentation在同一台服务器上,我也已经通过本地计算机上的UI对此进行了检查,以调用该webservice [/improve]
[improve2]我正在使用.net 3.5 [/improve2]
----------------------------

 [改进3],这是完整的错误文本
发生System.Net.WebException
  Message =基础连接已关闭:发送中发生意外错误."
  Source ="System.Web.Services"
  堆栈跟踪:
       在System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest请求)
       在System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest请求)
       在System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(字符串methodName,Object []参数)
       在NHTC.WA.DMS_Maroun.wsprojFileInsert.WSManageDMSProject.InsertFile(DataSet dsInput,String userName)在C:\ NHTC_TFS_WorkSpace \ OrganizationPortal \ UI \ DMS_Maroun \ NHTC.WA.DMS_Maroun \ NHTC.WA.DMS_Marows \ Reference cs:2212行
       在NHTC.WA.DMS_Maroun.iMultipleuploads_M.insertNewFiles()中的C:\ NHTC_TFS_WorkSpace \ OrganizationPortal \ UI \ DMS_Maroun \ NHTC.WA.DMS_Maroun \ NHTC.WA.DMS_Maroun \ iMultipleuploads_M.aspx.cs:
  InnerException:System.IO.IOException
       Message =无法将数据写入传输连接:无法对套接字执行操作,因为系统缺少足够的缓冲区空间或队列已满."
       Source =系统"
       堆栈跟踪:
            在System.Net.Sockets.NetworkStream.MultipleWrite(BufferOffsetSize []缓冲区)
            在System.Net.Connection.Write(ScatterGatherBuffers writeBuffer)
            在System.Net.ConnectStream.ResubmitWrite(ConnectStream oldStream,布尔值invalidWrite)
       InnerException:System.Net.Sockets.SocketException
            Message =无法在套接字上执行操作,因为系统缺少足够的缓冲区空间或队列已满"
            Source =系统"
            错误代码= 10055
            NativeErrorCode = 10055
            堆栈跟踪:
                 在System.Net.Sockets.Socket.MultipleSend(BufferOffsetSize []缓冲区,SocketFlags socketFlags)
                 在System.Net.Sockets.NetworkStream.MultipleWrite(BufferOffsetSize []缓冲区)
            InnerException:
[/improve] 

解决方案

基于错误消息:"基础连接已关闭:发送中发生意外错误.",由于此处的文件大小,它看起来并不像失败.听起来更像是由于上载的时间之间的连接已关闭.查看是否有这些帮助:
基础连接已关闭... [ ^ ]
解决基础连接已关闭... [


同样,在使用Web服务的客户端应用程序中的此标记.


我已将call webservice方法更改为普通的Web Service调用,并且仍然引发了相同的错误...

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]

解决方案

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...[^]


<httpruntime executiontimeout="10000" maxrequestlength="2000000" />


Also this tag in client application which is using web service ..


I''ve changed the call webservice method to normal web service calling and still the same error raised...


这篇关于将大文件上传到Webservice .net3.5时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆