ASP .NET Random Unhandled Exception
-
Hi, I'm currently pulling out my hair with what can only be described as completely random Unhandles Exception errors. They don't occur all of the time, but seem to when I need them not too, i.e. in front of colleges and not even custom errors catch them for some reason. They appear to occur when connecting to databases, and I cringe everytime I see my application attempt to connect to one. There is litterally no other information I can give because I simply don't get any. It can't be my code because sometimes it works and sometimes it doesn't. (I'm using MS Access). I've tried asking my host and they brush it off and say we can get our technicians to have a look, for £60 per half hour... this is Fasthosts who are a complete waste of time. Any ideas? Thanks
-
Hi, I'm currently pulling out my hair with what can only be described as completely random Unhandles Exception errors. They don't occur all of the time, but seem to when I need them not too, i.e. in front of colleges and not even custom errors catch them for some reason. They appear to occur when connecting to databases, and I cringe everytime I see my application attempt to connect to one. There is litterally no other information I can give because I simply don't get any. It can't be my code because sometimes it works and sometimes it doesn't. (I'm using MS Access). I've tried asking my host and they brush it off and say we can get our technicians to have a look, for £60 per half hour... this is Fasthosts who are a complete waste of time. Any ideas? Thanks
Aaron Hudson wrote:
There is litterally no other information I can give because I simply don't get any.
Then you have to make sure that you get it. The excpetion contains a lot of information on where and why it was thrown. Without that information, the best anyone can give you is guesswork. Any code that depends on something that you don't have full control over, should have it's own error handling. When you catch the exception, you can display all the information in it.
--- single minded; short sighted; long gone;
-
Aaron Hudson wrote:
There is litterally no other information I can give because I simply don't get any.
Then you have to make sure that you get it. The excpetion contains a lot of information on where and why it was thrown. Without that information, the best anyone can give you is guesswork. Any code that depends on something that you don't have full control over, should have it's own error handling. When you catch the exception, you can display all the information in it.
--- single minded; short sighted; long gone;
It seems to be when the Access database is opened. Is this most likey to be an Access, .NET or IIS issue? Cheers
-
Aaron Hudson wrote:
There is litterally no other information I can give because I simply don't get any.
Then you have to make sure that you get it. The excpetion contains a lot of information on where and why it was thrown. Without that information, the best anyone can give you is guesswork. Any code that depends on something that you don't have full control over, should have it's own error handling. When you catch the exception, you can display all the information in it.
--- single minded; short sighted; long gone;
Ok, I get this from Matrix (I use a Fasthosts dedicated server) Event code: 3005 Event message: An unhandled exception has occurred. Event time: 7/16/2007 7:19:29 PM Event time (UTC): 7/16/2007 6:19:29 PM Event ID: b910cc78da5f47c29371c31cf48216dc Event sequence: 21 Event occurrence: 1 Event detail code: 0 Application information: Application domain: /LM/W3SVC/3/ROOT-1-128290830698125000 Trust level: Full Application Virtual Path: / Application Path: D:\home\ Machine name: DSVR004315 Process information: Process ID: 1540 Process name: w3wp.exe Account name: NT AUTHORITY\NETWORK SERVICE Exception information: Exception type: OleDbException Exception message: Unspecified error Request information: Request URL: http://www.enterprise-learning-gateway.co.uk/project.aspx Request path: /project.aspx User host address: 212.132.0.11 User: Is authenticated: False Authentication Type: Thread account name: NT AUTHORITY\NETWORK SERVICE Thread information: Thread ID: 9 Thread account name: NT AUTHORITY\NETWORK SERVICE Is impersonating: False Stack trace: at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.OleDb.OleDbConnection.Open() at ASP.project_aspx.__Render__control2(HtmlTextWriter __w, Control parameterContainer) in D:\home\project.aspx:line 70 at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) at System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) at ASP.project_aspx.__Render__control1(HtmlTextWriter __w, Control parameterConta
-
Ok, I get this from Matrix (I use a Fasthosts dedicated server) Event code: 3005 Event message: An unhandled exception has occurred. Event time: 7/16/2007 7:19:29 PM Event time (UTC): 7/16/2007 6:19:29 PM Event ID: b910cc78da5f47c29371c31cf48216dc Event sequence: 21 Event occurrence: 1 Event detail code: 0 Application information: Application domain: /LM/W3SVC/3/ROOT-1-128290830698125000 Trust level: Full Application Virtual Path: / Application Path: D:\home\ Machine name: DSVR004315 Process information: Process ID: 1540 Process name: w3wp.exe Account name: NT AUTHORITY\NETWORK SERVICE Exception information: Exception type: OleDbException Exception message: Unspecified error Request information: Request URL: http://www.enterprise-learning-gateway.co.uk/project.aspx Request path: /project.aspx User host address: 212.132.0.11 User: Is authenticated: False Authentication Type: Thread account name: NT AUTHORITY\NETWORK SERVICE Thread information: Thread ID: 9 Thread account name: NT AUTHORITY\NETWORK SERVICE Is impersonating: False Stack trace: at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.OleDb.OleDbConnection.Open() at ASP.project_aspx.__Render__control2(HtmlTextWriter __w, Control parameterContainer) in D:\home\project.aspx:line 70 at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) at System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) at ASP.project_aspx.__Render__control1(HtmlTextWriter __w, Control parameterConta
The connection fails with the error message "Unspecified error". The most common reason for this is when you run out of available connections because you haven't closed the previous connections properly. The database driver only allows 64 simultaneous connections to the database. If you don't close the connections properly, they will remain open until the connection itself times out. When there are 64 connections already open, the database will not accept more connections. The typical behaviour for this problem is that the database stops accepting connections for a few minutes, then starts working again when one of the connections times out.
--- single minded; short sighted; long gone;
-
The connection fails with the error message "Unspecified error". The most common reason for this is when you run out of available connections because you haven't closed the previous connections properly. The database driver only allows 64 simultaneous connections to the database. If you don't close the connections properly, they will remain open until the connection itself times out. When there are 64 connections already open, the database will not accept more connections. The typical behaviour for this problem is that the database stops accepting connections for a few minutes, then starts working again when one of the connections times out.
--- single minded; short sighted; long gone;
Guffa wrote:
The connection fails with the error message "Unspecified error". The most common reason for this is when you run out of available connections because you haven't closed the previous connections properly. The database driver only allows 64 simultaneous connections to the database. If you don't close the connections properly, they will remain open until the connection itself times out. When there are 64 connections already open, the database will not accept more connections. The typical behaviour for this problem is that the database stops accepting connections for a few minutes, then starts working again when one of the connections times out.
Thanks, can I ask, when you say 64 connections, do you mean as in 64 in one instant, i.e. inserting, selecting or updating? Because I am actually opening and closing them at each chance I can. I do, however open the database, then loop the data, open the database depending on which record is open, and sometimes even do that again, which obviously qualifies as 3 opening, however it should be doing that within a matter of seconds surely? Here's the code from that page:
<% If Request.QueryString("process") = "" And Request.QueryString("name") = "" Then %> [Main Menu](index.aspx) \ **Project Manager \** <% Dim dbConn_DiaryPortfolioList As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath(dbLocation) & ";") dbConn_DiaryPortfolioList.Open() Dim dbSQL_DiaryPortfolioList As String = "SELECT * FROM tblProcesses ORDER BY proOrder ASC" Dim dbAdapter_DiaryPortfolioList As New OleDbDataAdapter(dbSQL_DiaryPortfolioList, dbConn_DiaryPortfolioList) Dim dbDataSet_DiaryPortfolioList As New DataSet dbAdapter_DiaryPortfolioList.Fill(dbDataSet_DiaryPortfolioList) Dim dbDataTable_DiaryPortfolioList As DataTable = dbDataSet_DiaryPortfolioList.Tables(0) Dim dbRecCount_DiaryPortfolioList As Integer = dbDataTable_DiaryPortfolioList.Rows.Count For dbLoop = 0 To dbRecCount_DiaryPortfolioList - 1
-
Guffa wrote:
The connection fails with the error message "Unspecified error". The most common reason for this is when you run out of available connections because you haven't closed the previous connections properly. The database driver only allows 64 simultaneous connections to the database. If you don't close the connections properly, they will remain open until the connection itself times out. When there are 64 connections already open, the database will not accept more connections. The typical behaviour for this problem is that the database stops accepting connections for a few minutes, then starts working again when one of the connections times out.
Thanks, can I ask, when you say 64 connections, do you mean as in 64 in one instant, i.e. inserting, selecting or updating? Because I am actually opening and closing them at each chance I can. I do, however open the database, then loop the data, open the database depending on which record is open, and sometimes even do that again, which obviously qualifies as 3 opening, however it should be doing that within a matter of seconds surely? Here's the code from that page:
<% If Request.QueryString("process") = "" And Request.QueryString("name") = "" Then %> [Main Menu](index.aspx) \ **Project Manager \** <% Dim dbConn_DiaryPortfolioList As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath(dbLocation) & ";") dbConn_DiaryPortfolioList.Open() Dim dbSQL_DiaryPortfolioList As String = "SELECT * FROM tblProcesses ORDER BY proOrder ASC" Dim dbAdapter_DiaryPortfolioList As New OleDbDataAdapter(dbSQL_DiaryPortfolioList, dbConn_DiaryPortfolioList) Dim dbDataSet_DiaryPortfolioList As New DataSet dbAdapter_DiaryPortfolioList.Fill(dbDataSet_DiaryPortfolioList) Dim dbDataTable_DiaryPortfolioList As DataTable = dbDataSet_DiaryPortfolioList.Tables(0) Dim dbRecCount_DiaryPortfolioList As Integer = dbDataTable_DiaryPortfolioList.Rows.Count For dbLoop = 0 To dbRecCount_DiaryPortfolioList - 1
No wonder that you are running out of connections. You open a new connection (dbConn_DiaryPortfolioList_Check1) for every record in tblProcesses, and you never close them. Same with dbConn_DiaryPortfolioList_Check2. After that I gave up trying to follow the code. Frankly, your code is a mess. It doesn't look as ASP.NET code at all, it looks like badly written ASP code. You really need to learn how to use codebehind, server controls, repeaters, databinding, et.c. Making queries inside a loop is very bad practice. You should create a query that fetches all the data that you need for all projects at once. Read up on the JOIN command in SQL. Normally you should only need a single database connection for a page. Try to fetch all the data that you need for the page, close the connection, then put the data into the page.
--- single minded; short sighted; long gone;