我应该如何跨应用程序域边界加载程序集来加载和卸载模块?

发布于 2024-09-28 12:56:36 字数 119 浏览 0 评论 0原文

我知道在运行时动态加载程序集的限制会阻止其卸载。相反,有人建议,如果这是一个要求,我应该改为加载其他应用程序域中的模块,然后跨域边界执行代码。

我怎样才能简化这个开发过程并处理这个场景?有哪些工具或框架可用?

I'm aware of the limitations of loading an assembly dynamically during run-time that prevents it from being unloaded. Instead it's been suggested that, if this is a requirement, that I should instead load modules in other application domains and then execute code across the domain boundries.

How can I ease this development process and work with this scenario? What tools or frameworks are available?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

奢华的一滴泪 2024-10-05 12:56:36

MEF [1] 是否引导您走向正确的方向?或者你可以选择温莎城堡 [2],尽管我不需要卸载其中任何一个。

[1] http://code.msdn.microsoft.com/mef

[2] http://www.castleproject.org/container/index.html

Does MEF [1] send you in the right direction? Or you could go with Castle Windsor [2], though I've not had a need to unload with either.

[1] http://code.msdn.microsoft.com/mef

[2] http://www.castleproject.org/container/index.html

羁绊已千年 2024-10-05 12:56:36

这取决于“主机”应用程序和动态加载的代码之间的交互有多复杂。如果它相当复杂,那么您可能需要采用完整的 System.AddIn 路线。如果您的交互相当简单,那么您可能应该编写自己的类来处理程序集的加载和卸载。我已经为各种较小的项目做过很多次了,所以如果有帮助的话我可以发布代码。

It depends on how complicated the interaction is between your "host" app and the dynamically loaded code. If it is fairly complicated then you may want to go the full System.AddIn route. If your interactions are fairly simple then you should probably just write your own classes to handle the loading and unloading of the assemblies. I've done this a number of times for various smaller projects so I can post code if that would be helpful.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文