增加.net中的Sql超时
我的 .net 服务中出现 SQL 超时错误。
由于该服务已安装在生产环境中,有什么方法可以增加 App.Config 文件中服务的超时时间。
目前,我在一分钟后收到此异常,我必须将其延长到大约 10 小时,因为我们使用的存储过程需要 2-2 小时才能执行。
I am gettting SQL time out error in my .net service.
As the service is already installed on the production, is there any way I can increase the timeout for the service from App.Config file.
At present, I am getting this exception after one minute, I have to make it to around 10 hours because the stored procedure we are using takes 2-2 hours to execute.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以尝试设置 CommandTimeout 属性在您的 SqlCommand 上。我希望您不要在 ASP.NET 应用程序中执行此操作。
You could try setting the CommandTimeout property on your SqlCommand. I hope you are not doing this in an ASP.NET application.
您可以使用“connect Timeout = 100000000;”在连接字符串中设置超时。或者任何你想要的超时时间
You can set the timeout in your connection string with "connect Timeout = 100000000;" or whatever you want your timeout to be
超时设置由数据库服务器决定。
在 SQL Server 管理器中,打开 SQL Server 属性,然后选择连接选项卡并将超时设置为您需要的大小。
诗。
零表示没有超时。
The time out setting is up to database server.
In SQL Server Manager open the SQL Server Properties and pick the connection tab and set time out as big as You need.
Ps.
zero goes for no timeout.