如何强制ASP.Net为无效(从而刷新)当前应用程序实例? [英] How do I force ASP.Net to invalid (and thus reload) the current application instance?

查看:199
本文介绍了如何强制ASP.Net为无效(从而刷新)当前应用程序实例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上我想,如果我是编辑web.config文件,将产生的影响。该应用程序基本上是完全卸载本身并再次启动,从而重新发射的Application_Start也开沟由现已解散的AppDomain中创建的任何动态创建的类型。

Basically I want the effect that would occur if I were to edit the web.config file. The application basically completely unloads itself and starts again, thus re-firing Application_Start and also ditching any dynamically created Types created by the now-defunct AppDomain.

修改

我需要做这在我的C#code我的web应用程序中。我知道这是可以做到;我做了很久很久以前,但此后失去了code和忘记我是如何做的。

I need to do this in my C# code inside my web application. I know it can be done; I did it ages ago but have since lost the code and forgotten how I did it.

推荐答案

有关完全信任您可以使用HttpRuntime.UnloadAppDomain()。如果你不完全信任的运行,你可以修改web.config文件的最后写入时间。里克·斯特劳曾在一个不错的类包裹这两种方法了

For full trust you can use HttpRuntime.UnloadAppDomain(). If you aren't running in full trust you can modify the last write time on the web.config file. Rick Strahl has wrapped these two approaches up in a nice class.

这篇关于如何强制ASP.Net为无效(从而刷新)当前应用程序实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆