如何获取我的应用程序创建的应用程序域列表? [英] How do I obtain a list of the application domains my application has created?
问题描述
我有一个服务应用程序,它在用于长时间运行的任务的过程中创建 AppDomain.我一直通过将它们存储在具有唯一 ID 的 Hashtable 中来跟踪它们.
I have a service app that creates AppDomain's during the course of its use for long running tasks. I've been tracking these by storing them in a Hashtable with a unique ID.
任务完成后,服务应用会卸载分配给该任务的 AppDomain,然后将其从 appdomain Hashtable 中删除.
After a task is completed the service app then unloads the AppDomain allocated to that task and then it's removed it from the appdomain Hashtable.
纯粹从健全性检查的角度来看,有没有办法可以查询 CLR 以查看创建应用程序域仍在加载哪些应用程序域(即,我可以将跟踪 Hashtable 与 CLR 实际看到的内容进行比较)?
Purely from a sanity checking point of view, is there a way I can query the CLR to see what app domains are still loaded by the creating app domain (i.e. so I can compare the tracking Hashtable against what the CLR actually sees)?
推荐答案
AFAIK,您需要保留自己的列表 - 就像您已经拥有的一样.
AFAIK, you need to keep your own list - like you are already.
这篇关于如何获取我的应用程序创建的应用程序域列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!