So the application is actually getting recompiled and since the default limit is 15 after 15 recompilation the app domain/application pool recycles.
Usually you will see an event in event viewer with event id - 1305. Open IIS Manager => Application Pools =>Right Click the Application pool and go to advanced settings => Scroll down to Generate Recycle Event Log Entry and change everything to true. Also you may need to enable health monitoring to see the details in event viewer.
When you increased it to 100 the limit is not reached and hence application pool would have recyled during the regular recycle schedule (default every 29 hours)
A list of what causes whole website recompile:
- By default, when any change is made to a top-level file in a Web site, the whole site is recompiled. Top-level files include the global.asax file and all files in the bin/ and App_Code/ folders. Additional details here - https://blogs.msdn.microsoft.com/tmarq/2007/11/01/asp-net-file-change-notifications-exactly-which-files-and-directories-are-monitored/
- modifying web.config
a configuration include file change, if the SectionInformation.RestartOnExternalChanges property is true
<section name="MyAppSettings" type="System.Configuration.AppSettingsSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOnExternalChanges="true" requirePermission="false" />
Notes:
If you want to be able to change top-level files without causing the whole site to be recompiled, you can set the optimizeCompilations attribute of the compilation element in the Web.config file to true
References:
Understanding ASP.Net dynamic compilations
One of the other common cause for recompilation is due to a file being written to the source code folder i.e. something like writing a log file with in the source code folder or anti virus trying to scan web app folder and probably writing something into it (you can exclude web app folder from anti virus scan and see if it helps).
However to exactly find out what is causing recompilation you need to capture a ETW trace and see. A detailed explanation is given here on how to do that - https://blogs.msdn.microsoft.com/tess/2008/11/06/troubleshooting-appdomain-restarts-and-other-issues-with-etw-tracing/
Also there is a known issue around this is mentioned here - http://support.microsoft.com/kb/319947
Relevant text from the link
However, this problem occurs when you load many new .aspx or .ascx
files to the server (for example, 61 files). The server unloads the
application when the first 15 files are recompiled and every time
another 15 files are recompiled until the server reaches 61. This
results in four application restarts even though only one is required.
It talks about memory implications so make sure you do have the periodic application pool recycling enabled.
Hope this helps
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…