蝈蝈俊.net

-- 用随笔来记录自己的技术感触
随笔 - 597, 评论 - 4064, 引用 - 276

导航

关于

这里是我的技术Blog,下一代CSDN社区Blog在 http://blog.csdn.net/ghj1976/

标签

每月存档

最新留言

  • re:学习笔记:7种结构型设计模式简单对比
    <p>最新在家创业系统 ----刚从国外引进,市场巨大。 ----在家可经营所有国家生意,事业规模宏大。 ----不需求人与说服;不用放厚脸皮去推销。 ----极小投资;零风险;成...
    by jackielongteng(注册) on 2009/6/14 13:43:56
  • re:作用域
    <p>☆                    &deg;∵☆       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...
    by jackielongteng(注册) on 2009/6/14 13:03:25
  • re:Html标签嵌套对展示性能的影响
    <p><strong>所有的浏览器都按照你提到的浏览器解析Html规则来解析嘛?</strong></p>
    by Cola(注册) on 2009/6/12 23:07:28
  • re:Html5
    <p>目前来说,HTML5还只是一个梦想,呵呵:)</p>
    by 开心就好(注册) on 2009/6/11 16:31:54
  • re:多线程与SqlConnection.Close
    <p>好服月租型IT服务台,与你共成长! 月租型ITSM软件,注册即可免费体验! 详情请登录官方网站:<a href="http://www.servicezon.co...
    by qzhibo(注册) on 2009/6/3 15:14:21
  • re:多线程Singleton单件模式
    <pre><span style="color: #0000ff;">//Another way public</span> <sp...
    by Yaojian(注册) on 2009/4/22 14:02:35
  • re:Thread.Sleep(0)
    <p>学习了~</p>
    by shuitong888(注册) on 2009/4/8 14:29:24
  • re:Html标签嵌套对展示性能的影响
    <p>DIV固然好 但IE6,7,8 firefox,safari ....做美工的人要累死.</p>
    by ryq1(注册) on 2009/4/3 14:16:25
  • re:用.net 编码实现朗读文本的方法
    <p>我第一次 按键时 能听到声音,但是第二次按键时,没反应。网页一直在 loading.&nbsp;是什么原因?</p>
    by tracytang949(注册) on 2009/3/27 7:01:09
  • re:information_schema.routines与sysobjects
    <p>用sys.procedures多好。</p>
    by luke(注册) on 2009/3/16 16:45:49
  • re:SQL Server 2005 配置发送邮件
    <p>&lt;A href="<a href="http://www.3rt.info">http://www.3rt.info</...
    by ives007(注册) on 2009/2/26 16:47:00
  • re:推荐 Gemini 这个bug管理工具
    <p>你好!首先非常感谢推荐使用Gemini,这段时间在使用Gemini,有些问题想请教以下。</p> <p>1.Create Issue 以后,设置了Visib...
    by CowboyRyan(注册) on 2009/2/20 15:45:08
  • re:推荐 Gemini 这个bug管理工具
    <p>你好!首先非常感谢推荐使用Gemini,这段时间在使用Gemini,有些问题想请教以下。</p> <p>1.Create Issue 以后,设置了Visib...
    by CowboyRyan(注册) on 2009/2/20 15:32:06
  • re:虚机搭配NLB负载平衡时碰到"没有接口可用于安装新的群集"的解决方案
    <p>google newsid</p>
    by iads(注册) on 2009/2/13 17:25:07
  • re:try catch 与线程
    <p>确实是这样的。因为异常机制本质上是堆栈操作,而各线程的堆栈是独立的。</p>
    by st_szr(注册) on 2009/1/21 9:46:05
  • re:try catch 与线程
    <p>没啥啊,线程就是新启动了一个,当然异常不会影响到原有的线程了。</p> <p>你应该在线程里面合适的位置写上自己的捕获代码就行了。</p>
    by laozizhu(注册) on 2009/1/19 16:33:21
  • re:我的2008,征服天堂
    <p>蝈蝈,可惜我帮不了你啊!</p>
    by laozizhu(注册) on 2009/1/19 16:25:45
  • re:try catch 与线程
    <p>呃&hellip;&hellip;是这样的。可怎么处理呢?</p>
    by Anders Liu(注册) on 2009/1/19 11:58:05
  • re:我的2008,征服天堂
    <p>博主是不是去了师部 做了侦查营长呢?</p>
    by huobazi(注册) on 2009/1/9 14:15:33
  • re:我的2008,征服天堂
    <p>@ghj1976:看来真的危机了</p>
    by 开心就好(注册) on 2009/1/9 10:17:37
  • re: 网络带宽的单位
    不过传输的时候,往往还有压缩。
    by luke(匿名) on 2008/12/15 11:00:21
  • re: 网络带宽的单位
    除10不仅仅是为了方便,在传输中,往往加上控制位,所以一个字节往往需要10Bit.
    by 关门放狗(匿名) on 2008/12/13 16:01:30
  • re: 多缓存并存
    对跨进程甚至跨服务器缓存的性能比较怀疑,进程通信和跨服务器通信代价不菲。即使有已有进程外数据可用,如果考虑在进程做份缓存,定期再进程间同步是否更佳?
    by jinglecat(匿名) on 2008/12/12 18:00:05
  • re: 网络带宽的单位
    好像还有一个为了方便换算,厂家使用的是 除10的处理方式的说法:于是100Mb/sec = 100M / 10 = 10M Byte/sec 所以我通常都是用除10而不是除8来做运算的。
    by kentliu(匿名) on 2008/12/11 11:38:55
  • re: 网络带宽的单位
    又不是大S小s
    by luke(匿名) on 2008/12/10 12:04:50

广告

 


如果你使用的数据库连接类是 the Data Access Application Blocks "SqlHelper" 或者 SqlClient Class , 你在执行一个很费时的SQL 操作时候,可能就会碰到下面的超时异常。

---------------------------

---------------------------
Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
---------------------------
OK  
---------------------------

你会说,我在连接字符串中已经 设置了 Connect Timeout=80000 ,并且数据库中超时连接也是设置的值是一个很大的值。为啥到了30秒,仍然超时了呢??

这是因为:
你的设置并没有问题,是你混淆了  SqlCommand.CommandTimeout  和 SqlConnection.ConnectionTimeout 这两个的区别了。
你的连接字符串中的超时只是设置的 SqlConnection.ConnectionTimeout 的值,而不是设置的 SqlCommand.CommandTimeout 的值。
SqlHelper 中并没有 SqlCommand.CommandTimeout 的相关设置。需要你自己设置。

下面是两个的比较:

SqlCommand.CommandTimeout
获取或设置在终止执行命令的尝试并生成错误之前的等待时间。
等待命令执行的时间(以秒为单位)。默认为 30 秒。


SqlConnection.ConnectionTimeout
获取在尝试建立连接时终止尝试并生成错误之前所等待的时间。
等待连接打开的时间(以秒为单位)。默认值为 15 秒。

一些更详细的对这个问题的描述看:
http://www.eggheadcafe.com/PrintSearchContent.asp?LINKID=357

这个问题可以算是 SqlHelper 设计的时候,一个考虑不周的地方吧。
SqlCommand.CommandTimeout 的默认值是30,对于我写的大多数程序来说,这个值足够了。所以一直都没有发现SqlHelper的这个问题。今天在查本地一台比较差的机子上生成一个超长帖子(近4000个回复)无响应的问题时候,才发现SQLHelper 存在的这个问题。

打印 | 张贴于 2004-06-15 14:56:00 | Tag:.net 编程心得

留言反馈

#Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. (转) 编辑
转自:http://blog.joycode.com/ghj/archive/2004/06/15/24612.aspx如果你使用的数据库连接类是theDataAccessApplicatio...
2007-09-17 16:02:00 | [匿名用户:WEBBER]
#re: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. 编辑
我也出現這個問題,但是很奇怪的是,我用winform執行storeproce又可行,web確不行,奇怪啊 !
2006-05-31 17:15:00 | [匿名用户:Ray]
#re: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. 编辑
我想恰恰相反,这正好是考虑周到的一点证明,第一个是连接超时,第二个是命令超时,两个当然不一样,而且很多情况下肯定要分别对待,只是很多人误解了这两点而已。
2005-11-10 10:12:00 | [匿名用户:netelf]
#re: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. 编辑
OracleCommand下面没有CommandTimeout参数,如果使用的是Oracle数据库,如何定义Command的超时呢?
2005-06-22 10:10:00 | [匿名用户:yonge]
#re: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. 编辑
Thanks a lot for the information.

It worked here.
2005-03-04 06:25:00 | [匿名用户:Any]
#re: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. 编辑
I am still getting the timeout error even after changing the Cmd.Commandtimeout to 0 also. I am using SqlHelper "Best practices" class for database interaction.

Can anybody know the possible cause of the problem....
2005-01-08 04:07:00 | [匿名用户:Test]
#re: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. 编辑
我的不费时,但刷新好多次后,也会出现这种状况,这是何原因,我在sql server里的连接设为0了,但照样出错,真不懂呢!
2004-12-01 13:56:00 | [匿名用户:Finer]
#Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. 编辑
Ping Back来自:blog.csdn.net
2004-08-10 13:45:00 | [匿名用户:Montaque]
#re: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. 编辑
Hao!!!
2004-08-10 12:37:00 | [匿名用户:montaque ]
#回复: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. 编辑
嘿嘿。咋跟我一样懒呀。我也是这么做的。

不过考虑到,这两个超时设置是完全不一样的东西。所以没敢说出来,怕被人作为反面教材批判。
2004-06-15 17:13:00 | [匿名用户:ghj1976]
#回复: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. 编辑
我在SQL Helper里把connection的timeout值赋给了command的timeout,因为connection的timeout是可以赋值的。算是一种偷懒的办法吧。
2004-06-15 15:56:00 | [匿名用户:SpiderMan]
#回复: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. 编辑
链接打不开
2004-06-15 15:29:00 | [匿名用户:jiezhi]
对不起,目前本随笔不允许发表新评论.

Powered by: Joycode.MVC引擎 0.5.1.0