I am getting this error occasionally, it usually happens after AT LEAST 1 hour of running the server. What can I do to fix it?

Code:
System.Net.HttpListenerException (0x80004005): An operation was attempted on a nonexistent network connection
   at System.Net.HttpResponseStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at System.Xml.XmlUtf8RawTextWriter.FlushBuffer()
   at System.Xml.XmlUtf8RawTextWriter.Flush()
   at System.Xml.XmlWellFormedWriter.Flush()
   at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
   at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle)
   at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces)
   at server.char.list.HandleRequest(HttpListenerContext context) in *\rotmg_svr\server\char\list.cs:line 88
   at server.Program.ProcessRequest(HttpListenerContext context) in *\rotmg_svr\server\Program.cs:line 104
System.Net.ProtocolViolationException: Bytes to be written to the stream exceedthe Content-Length bytes size specified.
   at System.Net.HttpResponseStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at System(.)IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
   at System(.)IO.StreamWriter.Dispose(Boolean disposing)
   at System(.)IO.TextWriter.Dispose()
   at server.Program.ProcessRequest(HttpListenerContext context) in *\rotmg_svr\server\Program.cs:line 101
EDIT: Had to replace . IO with (.)IO, please ignore the parenthesis. MPGH was censoring it for some reason.