WCF 服务超时 [英] WCF service timeout

查看:39
本文介绍了WCF 服务超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在服务端设置一个超时,以便请求在超过超时时停止处理?我知道我可以在客户端超时请求,但这不会停止服务器上的请求处理.

Is there a way to set a tiemout on the service side so that the request stops processing if it exceeds the timeout? I know I can time the request out on the client side, but that doesn't stop the processing of the request on the server.

我尝试添加以下绑定:

<basicHttpBinding>
    <binding name="timeout" receiveTimeout="00:01:00" closeTimeout="00:01:00" openTimeout="00:01:00" sendTimeout="00:01:00" />
</basicHttpBinding>

我还尝试在 system.web 节点中添加以下内容(单独并与上述内容一起):

I've also tried adding the following in the system.web node (separately and together with the above):

<httpRuntime executionTimeout="60" /> <!-- timeout after 60 seconds -->

推荐答案

没有内置(开箱即用)的方法来做到这一点.您可以设置的所有超时都与传输设置有关.简而言之,你必须自己做.

There is no built in (out of the box) way to do this. All of the timeouts that you can set are related to transport settings. In short words, you have to do that yourself.

另请参阅关于限制 WCF 执行时间的此答案.

Please also see this answer about limiting WCF execution time.

这篇关于WCF 服务超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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