This is an assumption, since there is a lot of reference code that we cannot see from this fragment published in the question.
I assume that you are not processing database connections correctly ( DB_Connection_s) for several reasons.
A) Fixed via reset
I get the following errors frequently , and i had to restart the IIS or
republish to fix the problem temporary`
, , , , .
B)
DB_Connection_s, , , , , ( , ).
, . , .Dispose(), . , , , IDisposable, using. using Dispose. IDisposable, ( ) , , .Dispose() .
:
@just_name - , , , . ~DBConnection(), , .Close(), .
i)
, , . " - undefined". - MSDN Object.Finalize. , , , , , .
ii) Dispose
.Close() , . , , , , , .
iii) Dispose
a)
, , . using(){} DBConnection. , :
DBConnection IDisposable,
public class DBConnection : IDisposable
{
public void Dispose()
{
connection.Dispose();
}
}
DBConnection :
using( var DB_Connection_s = new DBConnection() )
{
}
.Dispose(), }, . , , , - .
, , , .Close() .Dispose() , , , , .Dispose() not .
b) .Dispose()
.Dispose() . , using(){}. , , .
:
IfxDataReader ifxDataReaders = DB_Connection.DBCmd.ExecuteReader();
if (ifxDataReaders.Read()) {
item = (int)ifxDataReaders["emp_num"];
}
ifxDataReaders.Close();
. -, .Close(), . -, try, , ifxDataReaders , . .
, , .Dispose . ( .Dispose()).
using(IfxDataReader ifxDataReaders = DB_Connection.DBCmd.ExecuteReader())
{
if (ifxDataReaders.Read()) {
item = (int)ifxDataReaders["emp_num"];
}
}