Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Restart MVC4 project Programmatically

I need to restart my mvc4 web application programmatically. But System.Web.HttpRuntime.UnloadAppDomain() doesn't work.

What is the best way to restart asp.net mvc application? Please mind that changing web.config content or folder names doesn't solve my problem.

like image 359
Mesut Avatar asked Dec 20 '22 18:12

Mesut


1 Answers

this code work for me. just call it to reload application.

System.Web.HttpRuntime.UnloadAppDomain();

More info

This method will just unload our application. If you just put this method in an ASP.NET web button you are totally done. So when will our application reloaded? Actually if you click your button it will first launch our method and unload application. Further on the web page we are on at that moment will be reloaded as well, because we just clicked a button and the web page should refresh. After launching our method the page refresh process will cause our application to reload as well.

like image 141
Fred Avatar answered Jan 02 '23 10:01

Fred