Hi,
I recently created a web service with various functions calls to a Stored Procedure via the RetrievalProcedures (generated class in the SelfServicing template). This web service is getting multiple calls a minute.
With the first code block below, the connections remain open even after they are closed:
Code Block 1:
IRetrievalQuery query = RetrievalProcedures.GetSPNAMECallAsQuery(Convert.ToDecimal(10), 0);
query.Connection = DbUtils.CreateConnection();
query.Connection.Open();
IDataReader reader = query.Execute(CommandBehavior.Default);
string res = BuildXMLHeader() + BuildXML(reader, Language, true) + BuildXMLFooter();
query.Connection.Close();
Now, I modified the above code to this:
Code Block 2:
IRetrievalQuery query = RetrievalProcedures.GetPsbAvalanchePkgPsbAvaBullInternetGetCallAsQuery(Convert.ToDecimal(BulletinID), 0);
query.Connection = DbUtils.CreateConnection();
query.Connection.Open();
IDataReader reader = query.Execute(CommandBehavior.Default);
string res = BuildXMLHeader() + BuildXML(reader, Language, true) + BuildXMLFooter();
reader.Close();
reader.Dispose();
query.Connection = null;
query.Dispose();
reader = null;
query = null;
and I still had connections opened after calling all possible Close() and Dispose() functions.
I had to add the following call to code block 2 so that the DB connections are released:
GC.Collect();
Anyone seen this before?
Thanks,
-- Joel