From: Eli Silverman on 3 Jun 2010 12:10 I have inherited and application originally written in C# for .net 1.1. I am currently looking into upgrading it to .net 3.51. Everything seems to be working smoothly except we have a core DLL that we use to maintain our SQL connection. Everytime we open a page it calls this .dll to establish a SQL connection and then this connection is passed to our other DLLs that do the actual data queries. This has been working fine under 1.1 but now that I have converted to 3.51 it throws one of the two following messages: aspnet_wp.exe 5160 system.invalidoperationexception - when I just access the site internal .net framework data provider error 1 - when debugging from vs 2008 the class is defined as: public class DataStore : IDisposable with a private variable of : private SqlConnection privSqlConnection; and a dispose function public void Dispose() { if (privSqlConnection != null) { privSqlConnection.Close(); privSqlConnection.Dispose(); } privSqlConnection = null; } I have read a number of articles about how it is unsafe to call the close or dispose statement in our finalizer. I have been able to step around the problem by commenting out the close and dispose statements and the application appears to run stabily and maybe even a bit faster. But I have only traded problems for while the new code seems to run I am left with runaway connections. If I log into the application and go to do a particular lookup 10 times in the 1.1 version of the application my sql activity monitor seem to show 5 - 7 connections. Our actual production environment hosting 65 + concurrent users on 3 clustered web servers tends to hover at around 50 - 60 connections. If I repeat the process from the .net 3.51 code on the same test server my activity monitor shows about 28 connections for my one user. What do I need to do to get the dll. to close and release the connection back to the pooler without tripping over the garbage collector and throwing the errors above. Any suggestions on how to reduce the number of connections would also be greatly appreciated.
From: Eli Silverman on 3 Jun 2010 14:44 Never mind. I think I finally fixed the problem. "Eli Silverman" wrote: > I have inherited and application originally written in C# for .net 1.1. I am > currently looking into upgrading it to .net 3.51. Everything seems to be > working smoothly except we have a core DLL that we use to maintain our SQL > connection. > Everytime we open a page it calls this .dll to establish a SQL connection > and then this connection is passed to our other DLLs that do the actual data > queries. > This has been working fine under 1.1 but now that I have converted to 3.51 > it throws one of the two following messages: > aspnet_wp.exe 5160 system.invalidoperationexception - when I just access > the site > internal .net framework data provider error 1 - when debugging from vs 2008 > > the class is defined as: > public class DataStore : IDisposable > > with a private variable of : > private SqlConnection privSqlConnection; > > and a dispose function > public void Dispose() > { > if (privSqlConnection != null) > { > privSqlConnection.Close(); > privSqlConnection.Dispose(); > } > privSqlConnection = null; > } > > I have read a number of articles about how it is unsafe to call the close or > dispose statement in our finalizer. > > I have been able to step around the problem by commenting out the close and > dispose statements and the application appears to run stabily and maybe even > a bit faster. > > But I have only traded problems for while the new code seems to run I am > left with runaway connections. > > If I log into the application and go to do a particular lookup 10 times in > the 1.1 version of the application my sql activity monitor seem to show 5 - 7 > connections. > > Our actual production environment hosting 65 + concurrent users on 3 > clustered web servers tends to hover at around 50 - 60 connections. > > If I repeat the process from the .net 3.51 code on the same test server my > activity monitor shows about 28 connections for my one user. > > What do I need to do to get the dll. to close and release the connection > back to the pooler without tripping over the garbage collector and throwing > the errors above. > > Any suggestions on how to reduce the number of connections would also be > greatly appreciated.
|
Pages: 1 Prev: Outlook 2003 Plugin from visual studio 2008 Next: Socket Timeout at 2min |