Link to home
Start Free TrialLog in
Avatar of elimesika
elimesikaFlag for Israel

asked on

Query time out using ADO.NET

HI Experts

We are working with VS 2008 (.NET 3.5) and SQL Server 2005
DAL is Enterprise Library based  (using code generation)

All generated stored procedures were modified to catch exceptions and insert exception details to a dedicated log table.

Now, from time to time, we have an exception that claims on a time out that seems to be on the communication protocol (see snippet)

When I look in my database, no exception is recorded to my log table.

How can I trap (and hopefully resolve) this error ?
Can I modify the default  time out ???

Thanks

09Jul 13:53:59 [1740] ERROR - Query SearchQuery execution failed. Exception: VdcDAL.RepositoryFailureException: Unexpected error occurred in the database server ---> System.Data.SqlClient.SqlException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Practices.EnterpriseLibrary.Data.Database.DoExecuteReader(DbCommand command, CommandBehavior cmdBehavior)
   at Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteReader(DbCommand command)
   at VdcDAL.Repository`1.Find[TIdentity](ISelectionFactory`1 selectionFactory, IDomainObjectFactory`1 domainObjectFactory, TIdentity identity)
   at VdcDAL.VDSRepository.GetVdssBySql(String query)
   --- End of inner exception stack trace ---

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of appari
appari
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of elimesika

ASKER

HI

Thanks for your respond, I will try to set the CommandTimeout to higher value.

BTW
All DAL code is auto generated by Enterprise Library 2.0 DAAB
Thanks