积极答复者
请教一个wcf问题,如何设置OperationTimeout的属性

问题
-
碰到如下问题xxxx的请求操作在配置的超时(00:00:59.9531250)内未收到回复。分配给该操作的时间可能是更长超时的一部分。这可能由于服务仍在处理操作或服务无法发送回复消息。请考虑增加操作超时(将通道/代理转换为 IContextChannel 并设置 OperationTimeout 属性)并确保服务能够连接到客户端。但我没有找到OperationTimeout属性在哪里可以设置。请教各位高手。
- 已移动 Sheng Jiang 蒋晟Moderator 2009年12月9日 19:26 WCF (发件人:Visual C#)
答案
-
这里有个文章对此进行了分析。
默认的超时设置是1分钟,任何读写数据库超过一分钟都会导致这个错误
Problem
The same code sample will throw an Operation Timeout Error under the following circumstances:
- If there is a delay for More than a Minute in database responses
- OLEDB/SQL/ODBC Command Execution
- Dataadapter.Fill with
DataTable
orDataSet
- Reading data using
DataReader
The delay can happen in so many ways such as execution from Database, execution of Business logic from different layers, delay response from other interfaces referenced in the application. Because of these delays, the WCF client goes Idle from the WCF host. If the client goes Idle from the WCF service, it will throw the below error.
http://www.codeproject.com/KB/WCF/WCF_Operation_Timeout_.aspx
你可以使用代码来修改
(service, IContextChannel).OperationTimeout = New TimeSpan(0, 0, 240)
Frank Xu Lei--谦卑若愚,好学若饥
专注于.NET平台下分布式应用系统开发和企业应用系统集成
Focus on Distributed Applications Development and EAI based on .NET
欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum- 已建议为答案 Frank Xu LeiModerator 2010年1月11日 8:54
- 已标记为答案 Frank Xu LeiModerator 2011年4月2日 2:32
全部回复
-
参考一下这个http://www.codeproject.com/KB/WCF/WCF_Operation_Timeout_.aspx
http://www.codeproject.com/KB/WCF/WCF_Operation_Timeout_.aspx
Frank Xu Lei--谦卑若愚,好学若饥
专注于.NET平台下分布式应用系统开发和企业应用系统集成
Focus on Distributed Applications Development and EAI based on .NET
欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum -
Hi,
我今天也遇到这个问题了。
尝试在客户端的配置文件里,
把OpenTimeOut,等默认的TimeOut相关的属性值修改 的大一些。
检查一下你的服务,客户端配置。。
是否工作正常。
Frank Xu Lei--谦卑若愚,好学若饥
专注于.NET平台下分布式应用系统开发和企业应用系统集成
Focus on Distributed Applications Development and EAI based on .NET
欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum -
Hi,
我今天也遇到这个问题了。
尝试在客户端的配置文件里,
把OpenTimeOut,等默认的TimeOut相关的属性值修改 的大一些。
检查一下你的服务,客户端配置。。
是否工作正常。
Frank Xu Lei--谦卑若愚,好学若饥
专注于.NET平台下分布式应用系统开发和企业应用系统集成
Focus on Distributed Applications Development and EAI based on .NET
欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum
不行的OpenTimeOut与OperationTimeout 不一样 -
Hi,
你重新创建一下客户端代码。重新添加服务引用看看。
一般这个错误和你的客户端代码或者配置有关系。
Frank Xu Lei--谦卑若愚,好学若饥
专注于.NET平台下分布式应用系统开发和企业应用系统集成
Focus on Distributed Applications Development and EAI based on .NET
欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum- 已建议为答案 Mog Liang 2009年12月16日 9:44
-
这里有个文章对此进行了分析。
默认的超时设置是1分钟,任何读写数据库超过一分钟都会导致这个错误
Problem
The same code sample will throw an Operation Timeout Error under the following circumstances:
- If there is a delay for More than a Minute in database responses
- OLEDB/SQL/ODBC Command Execution
- Dataadapter.Fill with
DataTable
orDataSet
- Reading data using
DataReader
The delay can happen in so many ways such as execution from Database, execution of Business logic from different layers, delay response from other interfaces referenced in the application. Because of these delays, the WCF client goes Idle from the WCF host. If the client goes Idle from the WCF service, it will throw the below error.
http://www.codeproject.com/KB/WCF/WCF_Operation_Timeout_.aspx
你可以使用代码来修改
(service, IContextChannel).OperationTimeout = New TimeSpan(0, 0, 240)
Frank Xu Lei--谦卑若愚,好学若饥
专注于.NET平台下分布式应用系统开发和企业应用系统集成
Focus on Distributed Applications Development and EAI based on .NET
欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum- 已建议为答案 Frank Xu LeiModerator 2010年1月11日 8:54
- 已标记为答案 Frank Xu LeiModerator 2011年4月2日 2:32