I was read tons of articles where is specified that I can disable asp.net application recycling after web.config changes by using fcnMode="Disabled".
I want to keep my application state and not allow recycle after any configuration changes until I decide to recycle.
I prepare such configuration for IIS.
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.7.2"/>
<httpRuntime targetFramework="4.7.2" fcnMode="Disabled"/>
</system.web>
</configuration>
Every change of Web.Config in root of application cause recycle.
I write such simple Controller to test it. It save in static variable start of application (this is simulation of state). I view page in browser then touch/edit web.config file to see if IIS will reload application or not. I see every time that after series of F5/refresh time is not changing but after touch/edit everytime time is changing - it means that state is lost and application is recycled.
I tested it also in debugger and Controller is changing so application is recycling.
public class HomeController : Controller
{
public static DateTime startDate = DateTime.Now;
// GET: Home
public ActionResult Index()
{
ViewBag.StartDate = startDate;
return View();
}
}
Here is view:
<h2>Index</h2>
<pre>
Process: @(System.Diagnostics.Process.GetCurrentProcess().ProcessName)
Process start date: @(System.Diagnostics.Process.GetCurrentProcess().StartTime)
Application domain start date (controller static variable): @(ViewBag.StartDate)
</pre>
Read article before question: