套接字连接已中止.数据大小的问题? [英] The socket connection was aborted. Size of data issue?

查看:83
本文介绍了套接字连接已中止.数据大小的问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<!-/*样式定义*/p.MsoNormal,li.MsoNormal,div.MsoNormal {mso-style-parent:";边距:0in;底边距:.0001pt; mso分页:寡妇孤儿;字体大小:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} @page Section1 {size:8.5in 11.0in;利润:1.0英寸1.25英寸1.0英寸1.25英寸; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;}->

我正在尝试发送2900个对象的集合,每个对象具有18个属性,并且我得到下面的味精,我尝试仅发送100个obj且没有问题.我需要进行哪些更改才能将更多数据发送到WCF服务?


套接字连接已中止.这可能是由于处理您的消息时出错或远程主机超出了接收超时,或者是潜在的网络资源问题引起的.本地套接字超时为"00:01:00". ---> System.IO.IOException:写入操作失败,请参阅内部异常. ---> System.ServiceModel.CommunicationException:套接字连接已中止.这可能是由于处理您的消息时出错或远程主机超出了接收超时,或者是潜在的网络资源问题引起的.本地套接字超时为"00:01:00". ---> System.Net.Sockets.SocketException:建立的连接被主机中的软件中止了

在System.Net.Sockets.Socket.Send(Byte []缓冲区,Int32偏移量,Int32大小,SocketFlags socketFlags)

在System.ServiceModel.Channels.SocketConnection.Write(Byte []缓冲区,Int32偏移量,Int32大小,布尔立即数,TimeSpan超时)

-内部异常堆栈跟踪的结尾---

在System.ServiceModel.Channels.SocketConnection.Write(Byte []缓冲区,Int32偏移量,Int32大小,布尔立即数,TimeSpan超时)

在System.ServiceModel.Channels.BufferedConnection.WriteNow(Byte [] buffer,Int32 offset,Int32 size,TimeSpan timeout,BufferManager bufferManager)

在System.ServiceModel.Channels.BufferedConnection.Write(Byte []缓冲区,Int32偏移量,Int32大小,布尔立即数,TimeSpan超时)

at System.ServiceModel.Channels.ConnectionStream.Write(Byte [] buffer,Int32 offset,Int32 count)

System.Net.Security.NegotiateStream.StartWriting(Byte []缓冲区,Int32偏移量,Int32计数,AsyncProtocolRequest asyncRequest)上的

at System.Net.Security.NegotiateStream.ProcessWrite(Byte [] buffer,Int32 offset,Int32 count,AsyncProtocolRequest asyncRequest)

-内部异常堆栈跟踪的结尾---

at System.Net.Security.NegotiateStream.ProcessWrite(Byte [] buffer,Int32 offset,Int32 count,AsyncProtocolRequest asyncRequest)

at System.Net.Security.NegotiateStream.Write(Byte [] buffer,Int32 offset,Int32 count)

在System.ServiceModel.Channels.StreamConnection.Write(Byte []缓冲区,Int32偏移量,Int32大小,布尔立即数,TimeSpan超时)

-内部异常堆栈跟踪的结尾---


McC

解决方案

根据元素的数量,您可能正在达到MaxItemsInObjectGraph配额(默认值为64k,接近2900 * 18).尝试在客户端和服务器上都增加它(您可以使用端点或服务行为中的< dataContractSerializer>元素对其进行更改- http://msdn.microsoft.com/zh-cn/library/ms733025.aspx ),并查看跟踪记录以查看是什么异常导致套接字连接异常终止.

<!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} -->

I am trying to send a collection of 2900 objects having 18 properties each and I get the msg below, i tried only sending 100 obj and had no problem.  What changes do i need to allow me to send more data to my WCF Service?


  The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:01:00'. ---> System.IO.IOException: The write operation failed, see inner exception. ---> System.ServiceModel.CommunicationException: The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:01:00'. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine

   at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)

   at System.ServiceModel.Channels.SocketConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout)

   --- End of inner exception stack trace ---

   at System.ServiceModel.Channels.SocketConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout)

   at System.ServiceModel.Channels.BufferedConnection.WriteNow(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, BufferManager bufferManager)

   at System.ServiceModel.Channels.BufferedConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout)

   at System.ServiceModel.Channels.ConnectionStream.Write(Byte[] buffer, Int32 offset, Int32 count)

   at System.Net.Security.NegotiateStream.StartWriting(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)

   at System.Net.Security.NegotiateStream.ProcessWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)

   --- End of inner exception stack trace ---

   at System.Net.Security.NegotiateStream.ProcessWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)

   at System.Net.Security.NegotiateStream.Write(Byte[] buffer, Int32 offset, Int32 count)

   at System.ServiceModel.Channels.StreamConnection.Write(Byte[] buffer, Int32 offset, Int32 size, Boolean immediate, TimeSpan timeout)

   --- End of inner exception stack trace ---


McC

解决方案

Based on the number of the elements, it looks like you may be hitting the MaxItemsInObjectGraph quota (the default value is 64k, which is close to 2900*18). Try increasing it on both client and server (you can change it using a <dataContractSerializer> element in either an endpoint or a service behavior - http://msdn.microsoft.com/en-us/library/aa749852.aspx).

The best way to know for sure what is causing the problem is to enable tracing (http://msdn.microsoft.com/en-us/library/ms733025.aspx) at the server side, and looking at the traces to see what exception caused the socket connection to be aborted.


这篇关于套接字连接已中止.数据大小的问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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