asp.net - Why does Sql Server connection TimesOut -
I am using Enterprise Library data for your SQL database. I am using version 3.1. I am using this code to execute a long-running spa (about 1 minute).
Dim db As SqlDatabase = New SqlDatabase (System.Web.Configuration.WebConfigurationManager.ConnectionStrings ( "Portal connection"). The connection string) db.ExecuteNonQuery ( "spnametoexecute")< / Pre>The connection string looks like this
& lt; Add name = "portalConnection" connectionString = "Server = IP; database = DBName; uid = user; pwd = PWD; timeout = 180;" provider name = "System.Data.SqlClient" / & gt;The Revlak is that I always get the timeout exception, why is it so?
System.Data.SqlClient.SqlException: it went expired expiration. The timeout period has expired before the operation is completed or the server is not responding.
Well, there are some possibilities:
- Your query is very complex and takes a lot of time (try writing better TSQL, adding indexed, or trying to extend the timeout)
- You can get another SPID (possibly on another connection) blocking is being
usually, the second problem blockages etc. see (sp_who / sp_who2) to see what it is that there are no blocks. And use trace / profiler to check the first option.
Comments
Post a Comment