引发WCF openTimeout closeTimeout

发布于 2024-07-10 11:50:10 字数 234 浏览 5 评论 0原文

我希望测试并观察 WCF 客户端和服务主机之间的超时行为。 对于 receiveTimeout 和 sendTimeout,传输需要几秒以上的大字节流并将这些超时属性设置为低得离谱的值可能很容易。

但是,由于除了调用 serviceProxy.Open() 或 .Close() 方法之外,没有什么可以做的,所以我在想什么是延迟打开和关闭 WCF 连接的好方法,以跨越以下阈值: openTimeout和closeTimeout?

I wish to test and observe timeout behaviours between a WCF client and service host. For receiveTimeout and sendTimeout, it is probably easy to transmit a large byte stream that takes more than a few seconds and set those timeout attributes to ridiculously low values.

However, since there is nothing that can be done beyond the calling of a serviceProxy.Open() or .Close() methods, I am thinking what is a good way to delay the opening and closing of WCF connections, to cross the thresholds of openTimeout and closeTimeout?

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

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

发布评论

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

评论(1

萌梦深 2024-07-17 11:50:10

好吧,如果您已正确公开您的合约(作为接口),您可以模拟抛出 TimeoutException 的代理实例并将其传递给您的代码以供使用。

Well, if you have exposed your contracts correctly (as interfaces), you can mock an instance of the proxy which throws TimeoutException and pass it to your code for use.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文