使用c#windows服务执行存储过程 [英] execute store procedure using c# windows service

查看:141
本文介绍了使用c#windows服务执行存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了窗口服务,我想在此服务中执行SQL Server存储过程,所以现在我在Windows服务Timeout expired中收到此类错误。在操作或服务器完成之前已经过了超时时间没响应.c#windows service..

i have created window service and i want to execute SQL Server Stored procedure inside this service , so now i am getting this type of error in windows service " Timeout expired.The timeout period elapsed prior to completion of the operation or the server is not responding. c# windows service"..

推荐答案





正如你所说的那样4分钟,这对SQL Server来说是一项艰巨的任务。



你可以通过增加命令和连接超时的超时来解决这类问题,但它真的没有帮助你未来所以尝试在小查询中拆分Store过程的逻辑并按顺序运行它们(如果可能的话)。



为了避免这种错误你可以尝试:



SQL连接超时 [ ^ ]



< a href =http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.commandtimeout(v=vs.110).aspx> SQL命令超时 [ ^ ]



按SQL配置远程超时: http://msdn.microsoft.com/en-IN/library/ms189040.aspx [ ^ ]
Hi,

As you said its take 4 minutes so its a huge task for SQL Server.

You can solve this kind of problem by increasing timeout of your Command And Connection Timeouts but its really not help you in future so try to split logic of Store procedure in small query's and run them sequentially (if Possible).

To avoid this kind of error you can try :

SQL Connection Timeout[^]

SQL Command Timeout[^]

Configure Remote Time out by SQL : http://msdn.microsoft.com/en-IN/library/ms189040.aspx[^]


这篇关于使用c#windows服务执行存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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