Server Error in '/<folder>' ... ERROR [HYT00] ... Timeout expired
When trying to run a .NET web-application that retrieves data from a database, the following error is generated in the browser:
Server Error in '/<folder>' Application
ERROR [HYT00] [Microsoft][ODBC SQL Server Driver]Timeout expired
When retrieving data from the database, the request took longer to fulfil than the allotted timeout value. Hence the timeout error.
- Be sure to understand why you are getting timeouts. For example, check the indexes on the table (or tables) that are being queried. A timeout may indicate a problem that needs to be addressed with the database (or with the structure of your SQL query) and not with the code.
- Only if you have addressed point 1, then consider increasing the
timeout value. For example:
command.CommandTimeout = 60
where command is of type OdbcCommand and is used to create the OdbcDataAdapter on which the timeout is being encountered. The default timeout is 30 seconds, the line above increases this to 60 seconds.
These notes have been tested within Microsoft Visual Studio .NET 2003 running under Windows 2000, and may apply to other versions as well.
About the author: Brian Cryer is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.