简体   繁体   English

WCF服务超时设置

[英]WCF service timeout setting

I have a ASP.NET 4.0 app that is calling a WCF service. 我有一个调用WCF服务的ASP.NET 4.0应用程序。 For testing, the closeTimeout, openTimeout, receiveTimeout, and sendTimeout values in the wsHttpBinding binding are all set to 01:00:00. 为了进行测试,wsHttpBinding绑定中的closeTimeout,openTimeout,receiveTimeout和sendTimeout值都设置为01:00:00。

When I ran a test in which the service took 5 minutes 40 seconds, I could see the correct results of the WCF service in the app event log. 当我运行一项服务耗时5分40秒的测试时,我可以在应用程序事件日志中看到WCF服务的正确结果。 However, the app did not process the results. 但是,该应用程序未处理结果。

In subsequent identical tests in which the WCF service took less than 4 minutes, I could see the same correct results in the app event log, but the app processed the results correctly. 在随后的相同测试中,WCF服务花费了不到4分钟的时间,我可以在应用程序事件日志中看到相同的正确结果,但是应用程序正确地处理了结果。

I'm thinking there's another timeout setting I don't know about. 我在想还有另外一个我不知道的超时设置。 Any ideas? 有任何想法吗? Thanks. 谢谢。

Try the OperationTimeout property of the WCF service client where it is instantiated: 尝试实例化WCF服务客户端的OperationTimeout属性:

MyWCFServiceClient client = new MyWCFServiceClient();
client.InnerChannel.OperationTimeout = new TimeSpan(0, 10, 0);
client.Open();

The above will set the timeout to 10 minutes 上面将超时设置为10分钟

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM