2010-03-16 3 views
0

Я получаю эту ошибку, когда пытаюсь загрузить файл из 3mb или более в мое клиентское приложение WCF.Connection aborted

SocketException (0x2745): An established connection was aborted by the software in your host machine] 
    System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) +73 
    System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +131 

[IOException: Unable to read data from the transport connection: An established connection was aborted by the software in your host machine.] 
    System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +294 
    System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size) +26 
    System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead) +297 

[WebException: The underlying connection was closed: An unexpected error occurred on a receive.] 
    System.Net.HttpWebRequest.GetResponse() +5314029 
    System.ServiceModel.Channels.HttpChannelRequest.WaitForReply(TimeSpan timeout) +54 

[CommunicationException: An error occurred while receiving the HTTP response to http://localhost:4649/Service1.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.] 
    System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +7596735 
    System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +275 
    SmartConnectClient.SmartConnect.IService1.OrderCertMail(OrderCertMailResponse OrderCertMail1) +0 
    SmartConnectClient.SmartConnect.Service1Client.OrderCertMail(OrderCertMailResponse OrderCertMail1) in c:\documents and settings\pkale\my documents\visual studio 2008\projects\smartconnectclient\smartconnectclient\service references\smartconnect\reference.cs:1939 
    SmartConnectClient.Test_CertMail_Order.Page_Load(Object sender, EventArgs e) in C:\Documents and Settings\pkale\My Documents\Visual Studio 2008\Projects\SmartConnectClient\SmartConnectClient\Test_CertMail_Order.aspx.cs:40 
    System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14 
    System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35 
    System.Web.UI.Control.OnLoad(EventArgs e) +99 
    System.Web.UI.Control.LoadRecursive() +50 
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627 
+0

Пытались ли вы с меньшими файлами? Вы уверены, что у вас нет проблем с брандмауэром? – ChrisBD

ответ

2

Возможно, вам необходимо увеличить квоты на привязке сервера и на привязке клиента. http://msdn.microsoft.com/en-us/library/ms731078.aspx

Если сервер также является сервисом WCF, чтобы лучше диагностировать такие вещи, вы можете также enable WCF tracing at the server-side - и вы получите ошибки, связанные с такими вещами, как транспортные квоты и другие странные вещи, которые появляются в журнале обслуживания (что вы можете просмотр с помощью средства просмотра журналов служб, которое поставляется с Service Trace Viewer, входящим в состав Windows SDK).

Иногда вам необходимо выполнить IISReset или «прикоснуться» к web.config службы, чтобы заставить его закрыть файл трассировки службы, иначе просмотрщик трассировки не сможет увидеть всю активность в журнале.