如何找到事业消息SocketException一个已建立的连接被中止您的主机中的软件和? [英] How to find cause and of the SocketException with message that an established connection was aborted by the software in your host machine?

查看:257
本文介绍了如何找到事业消息SocketException一个已建立的连接被中止您的主机中的软件和?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道类似的问题可能已经问了很多次,但我想重新present我看到的行为,发现如果有人可以帮助predict这个原因。

我正在写一个窗口服务,连接到其他窗口服务通过TCP。 有这种100个用户的实体,并且每每次5连接。这些用户使用他们的个人连接执行任务。

应用程序继续withough发现这个问题1或2天。或有时起(-rarely)之后显示的问题。最好的来看,我不得不像4〜5天没有显示此异常。而在这之后的应用程序或死亡,我不得不停止以各种理由。

我想知道什么可以导致此? 这里是堆栈跟踪。

System.IO.IOException:无法将数据写入传输连接:一个已建立的连接被中止通过在主机中的软件。 ---> System.Net.Sockets.SocketException:已建立的连接被你的主机上的软件终止    在System.Net.Sockets.Socket.Send(字节[]缓冲区的Int32偏移的Int32大小的SocketFlags的SocketFlags)    在System.Net.Sockets.NetworkStream.Write(字节[]缓冲区的Int32偏移的Int32大小)    ---内部异常堆栈跟踪的结尾---    在System.Net.Sockets.NetworkStream.Write(字节[]缓冲区的Int32偏移的Int32大小)    在System.Net.Security._SslStream.StartWriting(字节[]缓冲区的Int32偏移的Int32计数,AsyncProtocolRequest的AsyncRequest)    在System.Net.Security._SslStream.ProcessWrite(字节[]缓冲区的Int32偏移的Int32计数,AsyncProtocolRequest的AsyncRequest)    在System.Net.Security.SslStream.Write(字节[]缓冲区的Int32偏移的Int32计数)

解决方案

你找到一个解决的办法?也许你可以更接近一个解决方案,如果您添加网络追踪到你的app.config?

 < XML版本=1.0&GT?;
<结构>
    < System.Diagnostics程序>
        <源>
            <信源名=的System.Net.Sockets>
                <听众>
                    <添加名称=套接字/>
                < /听众>
            < /源>
        < /来源>
        <开关>
            <添加名称=的System.Net.Sockets值=31/>
        < /开关>
        < sharedListeners>
            <添加名称=插座式=System.Diagnostics.TextWriterTraceListenerinitializeData =C:\ socketdump.log/>
        < / sharedListeners>
        <跟踪自动冲洗=真/>
    < /system.diagnostics>
< /结构>
 

另外,也许你可以设置日志记录TLS / SSL。添加以下DWORD并将其设置为7,你的注册表,重启并观看所有SCHANNEL事件在系统事件日志:

<$p$p><$c$c>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\EventLogging

希望能够帮助,但也可能是很多拳在黑暗中我猜...

I know the similar question may have been asked many times, but I want to represent the behavior I'm seeing and find if somebody can help predict the cause of this.

I am writing a windows service which connects to other windows service over TCP. There are 100 user entities of this, and 5 connections per each. These users perform their tasks using their individual connections.

The application goes on withough seeing this problem for 1 or 2 days. Or sometimes show the problem right after starting (-rarely). The best run I had was like 4 to 5 days without showing this exception. And after that application died or I had to stop it for various reasons.

I want to know what can be causing this? Here is the stacktrace.

System.IO.IOException: Unable to write data to the transport connection: An established connection was aborted by the software in your host machine. ---> 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.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size) --- End of inner exception stack trace --- at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size) at System.Net.Security._SslStream.StartWriting(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security._SslStream.ProcessWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslStream.Write(Byte[] buffer, Int32 offset, Int32 count)

解决方案

Did you find a solution to this? Perhaps you can come closer to a solution if you add network tracing to your app.config?

<?xml version="1.0"?>
<configuration>
    <system.diagnostics>
        <sources>
            <source name="System.Net.Sockets">
                <listeners>
                    <add name="Sockets"/>
                </listeners>
            </source>
        </sources>
        <switches>
            <add name="System.Net.Sockets" value="31"/>
        </switches>
        <sharedListeners>
            <add name="Sockets" type="System.Diagnostics.TextWriterTraceListener" initializeData="c:\socketdump.log"/>
        </sharedListeners>
        <trace autoflush="true"/>
    </system.diagnostics>
</configuration>

Also, perhaps you could setup logging for TLS/SSL. Add the following DWORD and set it to 7, to your registry, reboot and watch all schannel events in the System Event Log:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\EventLogging

Hope that help, but it might be lots of punches in the dark I guess...

这篇关于如何找到事业消息SocketException一个已建立的连接被中止您的主机中的软件和?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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