且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何处理在AppInitialize中创建的内容?

更新时间:2023-02-02 19:48:02

我还没有找到提及AppInitialize的等效方法 - 就我而言知道,你***的选择是使用ServiceHost.Closing。


这是一个更深入的描述:


http://blogs.msdn.com/b/wenlong/archive/2006/01/11/511514.aspx


We are experimenting with WAS hosted services in combination with AppFabric to eliminate the need for some classic Windows NT Services and have found the AppInitialize method to implement in an /App_Code based class.

But there is a problem... How to tear down stuff that was created in the AppInitialize method when the application dies or restarts? Is there another method to implement that will be called or some event that we could hook up to know when to dispose the allocated resources that we need to release?

Best regards,
Per Salmi


Per Salmi, Software Developer .NET Technologies PerSalmi.NET

I haven't been able to find mention of an equivalent method to AppInitialize- as far as I know, your best bet would be to use ServiceHost.Closing.

Here's a more in-depth description:

http://blogs.msdn.com/b/wenlong/archive/2006/01/11/511514.aspx