引发WCF openTimeout closeTimeout
我希望测试并观察 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,如果您已正确公开您的合约(作为接口),您可以模拟抛出 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.