How do I obtain a list of the application domains my application has created?

拈花ヽ惹草 提交于 2019-12-14 02:07:33

问题


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.

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.

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)?


回答1:


AFAIK, you need to keep your own list - like you are already.




回答2:


If you use the unmanaged APIs you may set-up a DomainManager that gets called on each AppDomain creation, and you'll find that many pieces are creating their own AppDomains, e.g. WCF. A detailed explanatin is in Customizing the Microsoft .NET Framework Common Language Runtime

Another route is using the debug APIs.




回答3:


I think you would like to check also this article - "Working with Application Domains in WPF".



来源:https://stackoverflow.com/questions/171541/how-do-i-obtain-a-list-of-the-application-domains-my-application-has-created

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!