I have pages which are using a master page.
An example page on my site would be the homepage, it makes 3 connections to mssql.
1) Get the keywords of the page
2) Get a list of news articles
3) Get the content of the page.
When I visual web express to debug the site it's giving me a pool error message, neither can I get the site to load directly via IIS. It says theres been a pool timeout.
I've read on the internet about making sure connections are closed when you are finished and I've checked that all database connections are closed using
finally
{
conn.Close();
}
does anyone have any idea why I would be having this problem?
How can I see what connections the site is opening, or maybe theres a limit on my server?
I'm using my own test server running windows 2003 and IIS
Don't increase the connection timeout unless there is a REAL need (15 sec by default).
Here are good links will help you hopfully:
http://blogs.msdn.com/angelsb/archive/2004/08/25/220333.aspx
http://www.15seconds.com/issue/040830.htm
http://kb.seekdotnet.com/ViewArticle.aspx?ID=35
Good luck.
|||As far as I can see I have NO leaking connections.
And I'm sure this is relating to the bug in visual studio because this happens when I try to access the page directly via IIS.
Does anyone else have any ideas?
Is there some way I can view connections and their state when I'm debugging the site?
|||Apply the latest service pack.
Yes, you can know the status by using one of the connection object proerity (con.status or something).
Good luck.
|||Checkout this link:http://geekswithblogs.net/chrishan/archive/2007/07/18/114030.aspx
I hope it will help you.
Good luck.
|||Thanks, I dont seem to be any further forward though.
One thing I have noticed is that in the Output window of Visual Studio I get the following error repeated constantly.
"A first chance exception of type 'System.Data.SqlClient.SqlException'' occurred in System.Data.Dll"
|||Surely someone can help with this?
Like I say, I don't believe this problem is with Visual Studio, as it occurs when I run the site directly on the server.
Here is the procedure which seems to be causing the problem, when I dont include this function the site runs fine, however when I include it it wont run and I get the error in my above post in the output window.
1protected void setConfigKeywords()2 {3// Define data objects4 SqlConnection conn;5 SqlCommand comm;6 SqlDataReader reader;78// Read the connection string from web.config9string connectionString = ConfigurationManager.ConnectionStrings["AWT"].ConnectionString;1011// Initialise the connection12 conn =new SqlConnection(connectionString);1314// Create command15 comm =new SqlCommand("SELECT * FROM Config WHERE ConfigID = 1", conn);1617try18 {19// Open the connection20 //conn.Open();2122 // Execute the command23 reader = comm.ExecuteReader();2425while (reader.Read())26 {27string title = reader["ConfigMetaTitle"].ToString();28string keywords = reader["ConfigMetaKeywords"].ToString();29string description = reader["ConfigMetaDesc"].ToString();30 }3132//Page.Title = title;33 //HtmlHead head = (HtmlHead)Page.Header;34 //Cls_Meta.setHeaderInfo(head, description, keywords);3536 // Close the reader37 reader.Close();3839 }40catch (Exception ex)41 {42string errorPage = ConfigurationManager.AppSettings["errorPage"];43string errorMsg ="Problem getting general keywords from database : " + ex;44 Server.Transfer(errorPage +"?errormsg=" + errorMsg);45 }46finally47 {48// Close the connection49 conn.Close();50 }51 }
No comments:
Post a Comment