ASP.NET Page Request Stage...
During the Page Request stage (prior to the Page life cycle), how does ASP.NET determine whether or not the Page needs to be 1) parsed and compiled for the first time or 2) re-parsed and re-compiled due to a markup change (assuming "Allow this precompiled site to be updatable" = true) or assembly change? I can make some pretty safe assumptions, but does anyone know exactly how ASP.NET makes these determinations?
The ASP.NET Page Life Cycle: http://msdn.microsoft.com/en-us/library/ms178472.aspx
EDIT: So, "first time" is determined as the very first resource request off the ASP.NET web site; soooooo, it's not a question of what Page or resource (singular) needs to开发者_StackOverflow中文版 be parsed and compiled the "first time" it is requested, rather ASP.NET parses and compiles EVERYTHING the FIRST TIME ANY Page or resource is requested. "Reparse and recompile" occurs in what appears to be a "lazy" fashion: when a change to a dynamically compiled file takes place, this invalidates the previously compiled, cached version of that file; this triggers recompilation of it and all effected resources THE NEXT TIME THE CODE IS REQUESTED - depending on the change made, 1-n to all files may have to be recompiled.
Thanks @Mass for the link
you can find all the answers you need at the link below:
Compiling on First Request
Recompiling on Change
Compilation Output
http://msdn.microsoft.com/en-us/library/ms366723.aspx
Regarding the second point ("re-parsed and re-compiled due to a markup change"):
There is a filesystem monitor started by the HTTP runtime. You may want to explore the HttpRuntime.StartMonitoringDirectoryRenamesAndBinDirectory()
method using the Reflector.
Monitoring is affected by the FCNMode
registry key setting under
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET (x86) HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\ASP.NET (x64)
精彩评论