Error disposing contextregistry contents / closing httpsession / clearing session cache

139 Views Asked by At

I encounter a fatal crush of an asp.net application when i run the app the second time. The first time after a re-build runs successfully, but the second run (without a new rebuild) fails. After a new re-build the app runs again but the second run without a new rebuild fails etc. So i have to rebuild each time for an app run to be successful.

Error: Cannot resolve type [BiFiModelSweden.BiFiModelSwedenClass] for object with name 'BiFiModelSweden' defined in file [C:...\bin\BiFiContext.xml] line 8

This occurs at the last command below while creating the IApplicationContext which is null:

String cx1 = ConfigurationManager.AppSettings["cx1"];
String cx2 = ConfigurationManager.AppSettings["cx2"];
IApplicationContext cxt = new XmlApplicationContext(HttpContext.Current.Request. MapPath(cx1), HttpContext.Current.Request.MapPath(cx2));

After profiling the development webserver running the application, using ANTS memory profiler, we get an output:

Not all objects were deleted from the contextregistry. Did you forget to use base.Dispose()?

We've then tried all we can to use the dispose method using all sorts of ways. We cannot get to overcome this fatal crash of the application!

extra observation: log4net keeps logging even if the application is stopped mid-way. Does this symbolise a zombie session? could this be the problem, that we never kill one session completely when we start a new applicaiton run/session? leading to the fatal exception? that the previous session is left hanging and holding on (locking) to resources?

if this is the case, we've tried all ways of killing the session: * session.Abandon() * gc.finalize() * etc

nothing works. The only workaround is manual deletion of the cache...which is impractical. How do we solve this!!

0

There are 0 best solutions below