[Mono-dev] WCF Fail with System.Net.Sockets.SocketException: Connection reset by peer

shahbour shahbour at gmail.com
Tue Jun 26 12:49:22 UTC 2012


Hello

I got an WCF service that is running except at some time if the client send
a request then close his program directly , ending the session the WCF
console application crashes with below error 


[0x7f0b42f55700:] EXCEPTION handling: System.Net.Sockets.SocketException:
Connection reset by peer
[0x7f0b42f55700:] EXCEPTION handling: System.IO.IOException: Read failure
[0x7f0b42f55700:] EXCEPTION handling: System.IO.IOException: Read failure

Unhandled Exception: System.IO.IOException: Read failure --->
System.Net.Sockets.SocketException: Connection reset by peer
  at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, Int32 offset,
Int32 size, SocketFlags flags) [0x000ad] in
/usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/Socket.cs:1606
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32
offset, Int32 size) [0x00067] in
/usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/NetworkStream.cs:399
  --- End of inner exception stack trace ---
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32
offset, Int32 size) [0x00078] in
/usr/local/src/mono-2.11.1/mcs/class/System/System.Net.Sockets/NetworkStream.cs:401
  at System.Net.RequestStream.Read (System.Byte[] buffer, Int32 offset,
Int32 count) [0x0003c] in
/usr/local/src/mono-2.11.1/mcs/class/System/System.Net/RequestStream.cs:142
  at System.IO.StreamReader.ReadBuffer () [0x00012] in
/usr/local/src/mono-2.11.1/mcs/class/corlib/System.IO/StreamReader.cs:394
  at System.IO.StreamReader.Read (System.Char[] buffer, Int32 index, Int32
count) [0x00062] in
/usr/local/src/mono-2.11.1/mcs/class/corlib/System.IO/StreamReader.cs:471
  at Mono.Xml2.XmlTextReader.ReadTextReader (Int32 remained) [0x0004f] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1256
  at Mono.Xml2.XmlTextReader.PeekChar () [0x00047] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1210
  at Mono.Xml2.XmlTextReader.ReadContent () [0x0003f] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1310
  at Mono.Xml2.XmlTextReader.Read () [0x00141] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:626
  at System.Xml.XmlTextReader.Read () [0x0006b] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlTextReader2.cs:564
  at System.Xml.XmlSimpleDictionaryReader.Read () [0x00000] in
/usr/local/src/mono-2.11.1/mcs/class/System.Runtime.Serialization/System.Xml/XmlSimpleDictionaryReader.cs:253
  at System.Xml.XmlReader.MoveToContent () [0x00050] in
/usr/local/src/mono-2.11.1/mcs/class/System.XML/System.Xml/XmlReader.cs:574
  at System.ServiceModel.Channels.XmlReaderMessage.ReadEnvelopeStart ()
[0x00000] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs:146
  at System.ServiceModel.Channels.XmlReaderMessage..ctor
(System.ServiceModel.Channels.MessageVersion version,
System.Xml.XmlDictionaryReader reader, Int32 maxSizeOfHeaders) [0x00026] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs:70
  at System.ServiceModel.Channels.Message.CreateMessage
(System.Xml.XmlDictionaryReader envelopeReader, Int32 maxSizeOfHeaders,
System.ServiceModel.Channels.MessageVersion version) [0x00022] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/Message.cs:427
  at System.ServiceModel.Channels.TextMessageEncoder.ReadMessage
(System.IO.Stream stream, Int32 maxSizeOfHeaders, System.String contentType)
[0x00011] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TextMessageEncoder.cs:87
  at System.ServiceModel.Channels.Http.HttpReplyChannel.CreatePostMessage
(System.ServiceModel.Channels.Http.HttpContextInfo ctxi) [0x00081] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs:229
  at System.ServiceModel.Channels.Http.HttpReplyChannel.TryReceiveRequest
(TimeSpan timeout, System.ServiceModel.Channels.RequestContext& context)
[0x000aa] in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs:172
  at
System.ServiceModel.Channels.ReplyChannelBase.<BeginTryReceiveRequest>m__10
(TimeSpan tout, System.ServiceModel.Channels.RequestContext& ctx) [0x0002f]
in
/usr/local/src/mono-2.11.1/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReplyChannelBase.cs:126

I couldn't figure out how to check the connection status before trying to
ReadMessage or CreatePostMessage functions.

Any Help ??


--
View this message in context: http://mono.1490590.n4.nabble.com/WCF-Fail-with-System-Net-Sockets-SocketException-Connection-reset-by-peer-tp4650173.html
Sent from the Mono - Dev mailing list archive at Nabble.com.


More information about the Mono-devel-list mailing list