Basically I am getting this message every now and again: "Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached." But the weirdest thing is I am closing all my connections, and using a single connection string to my SQL Server database. Here is a typical function to prove this:
Public Shared Function GetTheMenu() As SqlDataReader
Dim connection As New SqlConnection(dbconnection.connString)
Dim command As New SqlCommand("SP_GetTheMenu", connection)
command.CommandType = CommandType.StoredProcedure
connection.Open()
Return command.ExecuteReader(CommandBehavior.CloseConnection)
End Function
When I go into SQL i just see loads of open connections to the database with references to the stored procedure that has been executed - surely this should not be the case if the stored procedure is a simple Select statement that is pases a value to to a datareader, and is (supposedly) automatically closed?
Can anyone suggest reasons why this is happening?
Thanks.
I have seen this error before. Have you tried calling Close() manually on the connection object?
Andy.![]()
You can check the master..sysprocesses to find out current connections on the SQL Server. Please take a look at this post:
http://forums.asp.net/thread/1400183.aspx
No comments:
Post a Comment