更改默认的SqlCommand的CommandTimeout与配置,而不​​是重新编译? [英] Change the default SqlCommand CommandTimeout with configuration rather than recompile?

查看:2700
本文介绍了更改默认的SqlCommand的CommandTimeout与配置,而不​​是重新编译?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我支持一个ASP.Net 3.5 Web应用程序和用户试图运行报告时,30秒后遇到超时错误。看各地的网络现在看来,这是很容易更改超时在code,可惜我不能够访问code和重新编译。反正是有配置默认无论是Web应用程序,工作进程,IIS或整台机器?

I am supporting an ASP.Net 3.5 web application and users are experiencing a timeout error after 30 seconds when trying to run a report. Looking around the web it seems it's easy enough to change the timeout in the code, unfortunately I'm not able to access the code and recompile. Is there anyway to configure the default for either the web app, the worker process, IIS or the whole machine?

下面是堆栈跟踪到哪里它在System.Data这万一一点上,我错过了一些其他问题:

Here is the stack trace up to the point where it's in System.Data in case I'm missing some other problem:

[SqlException (0x80131904): Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.]
  System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1948826
  System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4844747
  System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
  System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
  System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33
  System.Data.SqlClient.SqlDataReader.get_MetaData() +83
  System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297
  System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954
  System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
  System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
  System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141
  System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12
  System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +10
  System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +130
  System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) +162
  System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) +115

- 编辑

有必须是$ C $之外的东西C本身 - 我已经下载了数据库,并运行它安装对在测试服务器上相同的网站,它运行的时间超过30秒,返回报告。我比较了在现场和试验的净目录在machine.config和web.config文件中,他们似乎是相同的,比较的两个IIS设置,又看了看SQL Server配置,唯一不同的是,活服务器在64位W2K3聚集,而在测试服务器上的32位。

There must be something outside the code itself - I've downloaded the database and run it against the same web site installed on a test server and it runs for longer than 30 seconds and returns the report. I've compared the machine.config and web.config files from the .Net directory on the live and test and they seem the same, compared the two IIS setups, also looked at the SQL Server configuration and the only difference is that the live server is clustered on 64bit W2K3 while the test server is on 32bit.

推荐答案

不幸的是,一切我已经在过去读到这个说不准,无法通过配置来控制。这是一个令人失望。

Unfortunately, everything I've read about this in the past says no, can't be controlled via configuration. Which is a bummer.

这篇关于更改默认的SqlCommand的CommandTimeout与配置,而不​​是重新编译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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