我有一个使用 WCF 服务的 Windows 应用程序。它有一些WCF服务调用,并且总是在之后调用ClientBase.Close()
方法。当我关闭应用程序时,我在 VS2010 中没有收到任何错误。我已经打开了调试器中的所有异常,并将我的编译器附加到了我能做的一切。我正在关闭所有连接,并且当我关闭应用程序时,没有 WCF 服务调用异步运行。
但是我确实在 WCF 服务上遇到了异常!
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 (some big number goes here).
错误代码为10054
内部异常是:
An existing connection was forcibly closed by the remote host.
但是我的代码怎么会发生这种情况呢?
我该怎么做才能找到这种错误行为的原因?
最佳答案
增加ChannelInitializationTimeout
Maximum time to wait for a connection to send the preamble during the initial read. This data is received before authentication occurs.
默认值为 5 秒。这是因为“现有连接被远程主机强制关闭”。异常。
关于.net - WCF 连接被错误中止/现有连接被远程主机强制关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10436297/