简体   繁体   中英

Recycle app pool in a ASP.NET web request

Is it possible to recycle the application pool of an ASP.NET application in a http request received to the application? I would like to have a method the recycle the application pool easily without having to login to the machine.

A usual way to restart an ASP.NET application is calling:

HttpRuntime.UnloadAppDomain();

So place the call into your page or handler.

There are several ways to recycle app pool

 Process process = Process.GetCurrentProcess();
 process.Kill(); // This will kill your worker process

OR

 HttpRuntime.UnloadAppDomain(); // Kill app domain. Next request will restart the app domain

OR Programatically touch your web.config and that should also trigger app recycle

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM