如何处理在AppInitialize中创建的内容? [英] How to dispose what was created in AppInitialize?

查看:188
本文介绍了如何处理在AppInitialize中创建的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在尝试将WAS托管服务与AppFabric结合使用,以消除对某些经典Windows NT服务的需求,并发现AppInitialize方法在基于/ App_Code的类中实现。


但是有一个问题......当应用程序死机或重新启动时,如何拆除在AppInitialize方法中创建的内容?是否有另一种方法可以实现,或者我们可以联系一些事件以了解何时处理我们需要释放的
已分配资源?


祝你好运,

Per Salmi


Per Salmi,软件开发人员。 NET Technologies   PerSalmi.NET

解决方案

我还没有找到提及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


这篇关于如何处理在AppInitialize中创建的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆