.net - When to dispose static resources in ASP.NET MVC application life-cycle -
we have idisposable resource relatively expensive instantiate although stateless , thread safe. so... decided wrap using standard singleton pattern , re-use single instance requests until app-pool recycles.
with in mind, still want call dispose() in deterministic fashion if possible.
the question... appropriate place dispose such resources, assuming ever have opportunity graceful in shut-down scenario? example...
for context, application asp.net mvc 4.
protected void application_disposed(object sender, eventargs e) { cleanupresources(); } or...
protected void application_end(object sender, eventargs e) { cleanupresources(); }
the reliable way know of hook application end event iregisteredobject. don't know reliability of application_end.
Comments
Post a Comment