为什么我会收到连接中止的消息?

时间:2010-01-07 17:12:18

标签: c# asp.net xml xml-rpc

我有一个网络表单,使用http://www.xml-rpc.net中的此库向第三方服务发送数据。

最近,表单已经开始抛出异常。我已经尝试在web.config中启用跟踪以查看来回传输的数据,但这似乎解决了问题,或者至少停止抛出异常。

任何想法可能会发生什么,或者如何在没有明显解决问题的情况下诊断出来?

跟踪代码:

    <system.diagnostics>
    <trace autoflush="true" />
    <sources>
        <source name="System.Net">
            <listeners>
                <add name="WebPageTraceListener"
                    type="System.Web.WebPageTraceListener, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
            </listeners>
        </source>
    </sources>
    <switches>
        <add name="System.Net" value="Verbose" />
    </switches>
</system.diagnostics>

异常消息:

  

System.Net.Sockets.SocketException:已建立的连接已被主机中的软件中止   [SocketException(0x2745):已建立的连接被主机中的软件中止]      System.Net.Sockets.Socket.Receive(Byte []缓冲区,Int32偏移量,Int32大小,SocketFlags socketFlags)+73      System.Net.Sockets.NetworkStream.Read(Byte []缓冲区,Int32偏移量,Int32大小)+131   [IOException:无法从传输连接读取数据:已建立的连接已被主机中的软件中止。]      System.Net.ConnectStream.Read(Byte []缓冲区,Int32偏移量,Int32大小)+313      System.Xml.XmlTextReaderImpl.ReadData()+ 444      System.Xml.XmlTextReaderImpl.EatWhitespaces(BufferBuilder sb)+285      System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()+74      System.Xml.XmlTextReaderImpl.ParseDocumentContent()+ 187      System.Xml.XmlTextReaderImpl.Read()+ 151      System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)+48      System.Xml.XmlLoader.Load(XmlDocument doc,XmlReader reader,Boolean preserveWhitespace)+129      System.Xml.XmlDocument.Load(XmlReader reader)+108      System.Xml.XmlDocument.Load(Stream inStream)+91      CookComputing.XmlRpc.XmlRpcSerializer.DeserializeResponse(Stream stm,Type svcType)+189   [XmlRpcIllFormedXmlException:来自服务器的响应不包含有效的XML。]      CookComputing.XmlRpc.XmlRpcSerializer.DeserializeResponse(Stream stm,Type svcType)+238      CookComputing.XmlRpc.XmlRpcClientProtocol.ReadResponse(XmlRpcRequest req,WebResponse webResp,Stream respStm,Type returnType)+111      CookComputing.XmlRpc.XmlRpcClientProtocol.Invoke(Object clientObj,MethodInfo mi,Object [] parameters)+762      CookComputing.XmlRpc.XmlRpcClientProtocol.Invoke(MethodInfo mi,Object [] Parameters)+11      XmlRpcProxyfd5eb8e7-d547-4544-bd38-7d6dc1366a49.login(String username,String password)+120

1 个答案:

答案 0 :(得分:0)

我认为关键可能在底部附近:

+129 System.Xml.XmlDocument.Load(XmlReader reader) +108 System.Xml.XmlDocument.Load(Stream inStream) +91 CookComputing.XmlRpc.XmlRpcSerializer.DeserializeResponse(Stream stm, Type svcType) +189 [XmlRpcIllFormedXmlException: Response from server does not contain valid XML.]

您的远程服务器正在使用无效的xml文档进行响应,看起来您的连接因此而死亡。