文件夹内容更改时重新启动 ASP.NET 应用程序

发布于 2024-07-09 10:52:25 字数 248 浏览 5 评论 0原文

我正在编写一个带有“插件”的网络应用程序。 这些插件将是 .DLL 文件,它将通过预定义的接口和东西导出其功能。 所有 .DLL 文件都位于名为“Plugins”的文件夹中,ASP.NET 应用程序在启动时加载它们(通过使用 Assembly.LoadFrom)。

问题是,在开发时,这些插件会经常更改(所有功能都在插件中,网站本身只是一个骨架)。 因此,我需要一种在 .DLL 文件更改时自动重新启动应用程序的方法。

我怎么做?

I'm writing a web application that will have "plugins". The plugins will be .DLL files which will export their functionality through predefined interfaces 'n stuff. All the .DLL files are in a folder called "Plugins", and the ASP.NET application loads them all upon startup (by using Assembly.LoadFrom).

The problem is that when developing, these plugins will change fairly often (all the functionality is in the plugins, the website itself is just a skeleton). Thus, I need a way to automatically restart the application when the .DLL files change.

How do I do that?

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

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

发布评论

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

评论(2

晨与橙与城 2024-07-16 10:52:25

如果插件目录位于您的 Bin 目录下,则当发生任何更改时,Web 应用程序将自动重新启动。

IF the plugins directory is under your Bin directory, the web app will automatically be restarted when anything changes.

Saygoodbye 2024-07-16 10:52:25

FileSystemWatcher 类是此类问题的通用解决方案问题,HttpRuntime.UnloadAppDomain(); 是重新启动应用程序的一种方法。 我认为需要更多的研究/解释:有很多可能的解决方案。

编辑:探索路径。 很好的答案。

The FileSystemWatcher class is a general solution to these kind of problems, and HttpRuntime.UnloadAppDomain(); is one way to restart your app. I think more research/explanation is required: there are many possible solutions.

Edit: Probling Paths. Nice answer.

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