使用 SSL 的 WCF 连接关闭速度非常慢

发布于 2024-09-25 14:19:40 字数 423 浏览 2 评论 0原文

我们拥有针对不同客户通过多种协议运行的 WCF 服务。大多数工作正常,但当我们使用 SSL 时,连接需要很长时间才能关闭。打开连接没有问题,但是关闭连接很慢。

最奇怪的行为是关闭时间与连接上传输的数据量成正比。如果仅从服务器向客户端发送几个字节,则连接几乎会立即关闭,但返回数百行的搜索需要与原始搜索一样长的时间才能关闭连接。关闭时间似乎与传输的数据量成正比。似乎在连接关闭之前将结果重新传输回服务器进行验证。

几乎不会抛出错误,但连接关闭时间实质上使执行调用所需的时间加倍。

以下是基本设置: 定制绑定 二进制编码 可靠会话,Ordered=true 绑定元素是 HttpsTransportBindingElement 使用 RemoteCertificateValidationCallback

所有代理都是使用 ChannelFactory 以编程方式构建的。

We have WCF services that operate over multiple protocols for different customers. Most work fine, but when we use SSL the connections take a long time to close. Opening a connection is no problem, but closing is very slow.

The strangest behavior is that the close time is proportional to the amount of data that was transmitted on the connection. If just a few bytes are sent from the server to the client the connection will close almost instantly, but a search that returns several hundred rows takes as long to close the connection as the original search. The close time seems directly proportional to amount of data transmitted. It seems that the results are retransmitted back to the server for verification before the connection will close.

An error is almost never thrown, but the connection close time essentially doubles the required time to execute a call.

Here are the basic settings:
Custom binding
Binary encoding
Reliable session, Ordered=true
Binding element is HttpsTransportBindingElement
using RemoteCertificateValidationCallback

All of the proxies are constructed programmatically with ChannelFactory.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

玉环 2024-10-02 14:19:40

我们发现问题出在 ReliableSession 上。 ReliableSession 尝试验证下一个连接中发送的所有内容。这听起来是个好主意,但它本质上毫无价值,因为即使我发现了一些未经验证的东西,也为时已晚,无法采取任何行动。

底线:ReliableSession 不太可靠。

We found that the problem was with ReliableSession. ReliableSession tries to verify everything that was sent in the next connection. This sounds like a good idea, but it is essentially worthless because even if I found something that didn't verify it is too late to do anything about it.

Bottom line: ReliableSession isn't very reliable.

落花随流水 2024-10-02 14:19:40

只是一个理论,它可能是在代理关闭时写入日志,并且由于解密而导致额外的命中,或者它不缓存 https 结果。

  • 您是否打开了 WCF 日志记录?
  • 关闭代理时 CPU 是否会出现峰值?
  • 您能否检查它是否实际上向服务器发送了两个请求?

Just a theory it could be that it writes to a log when the proxy closes, and you get an extra hit due to decryption, or that it does not cache https results.

  • Do you have any WCF logging turned on?
  • Does the CPU spike when you close the proxy?
  • Could you check if it is actually sending two requests to the server?
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文