检测ASP.NET网站中的更改

时间:2021-05-19 03:17:31

The ASP.NET framework does a very good job of detecting when a file has changed and recompiling that file etc. I would like to be able to hook into that update process. Is this at all possible?

ASP.NET框架在检测文件何时更改并重新编译该文件等方面做得非常好。我希望能够挂钩到该更新过程。这是可能吗?

I might want to do this as part of an initiative to try and version web sites developed as Web Site projects, versus Web Applications, where the version is easily found in statically deployed assemblies. If I my be misdirecting my energies as there are already better way if versioning web sites, I'd still appreciate some pointers.

我可能希望将此作为尝试和开发Web站点项目的网站的一部分,而不是Web应用程序,其中版本很容易在静态部署的程序集中找到。如果我误导我的能量,因为如果版本化网站已经有更好的方法,我仍然会欣赏一些指示。

5 个解决方案

#1


I don't know if you can hook into that logic at all - perhaps you could add your code to Application_OnStart as this method will fire when ASP.NET recycles the AppPool and restarts the website.

我不知道你是否可以完全接触到这个逻辑 - 也许你可以将你的代码添加到Application_OnStart,因为当ASP.NET回收AppPool并重新启动网站时,这个方法会触发。

#2


Have you tried Web Deployment projects?

您是否尝试过Web部署项目?

Scott Gu has a blog post.

Scott Gu有一篇博客文章。

#3


You can use ASP.NET SignalR to do it, It's real-time web for .NET

您可以使用ASP.NET SignalR来实现它,它是.NET的实时Web

#4


Have you tried developing a separate module for ASP.NET that keeps track of last change?

您是否尝试为ASP.NET开发一个单独的模块来跟踪上次更改?

#5


This might put you on the right path (might -- I haven't tried this).

这可能会让你走上正确的道路(可能 - 我没试过这个)。

http://www.codersource.net/csharp_iis_metabase.html (dead link)

http://www.codersource.net/csharp_iis_metabase.html(死链接)

#1


I don't know if you can hook into that logic at all - perhaps you could add your code to Application_OnStart as this method will fire when ASP.NET recycles the AppPool and restarts the website.

我不知道你是否可以完全接触到这个逻辑 - 也许你可以将你的代码添加到Application_OnStart,因为当ASP.NET回收AppPool并重新启动网站时,这个方法会触发。

#2


Have you tried Web Deployment projects?

您是否尝试过Web部署项目?

Scott Gu has a blog post.

Scott Gu有一篇博客文章。

#3


You can use ASP.NET SignalR to do it, It's real-time web for .NET

您可以使用ASP.NET SignalR来实现它,它是.NET的实时Web

#4


Have you tried developing a separate module for ASP.NET that keeps track of last change?

您是否尝试为ASP.NET开发一个单独的模块来跟踪上次更改?

#5


This might put you on the right path (might -- I haven't tried this).

这可能会让你走上正确的道路(可能 - 我没试过这个)。

http://www.codersource.net/csharp_iis_metabase.html (dead link)

http://www.codersource.net/csharp_iis_metabase.html(死链接)