3

Changes in ascx / aspx files - will it reset application? Sometimes on dev server they won't cause it whereas on live server I think it sometimes causes it. What is the rule?

Thanks Pawel

dragonfly
  • 17,407
  • 30
  • 110
  • 219

3 Answers3

6

It depends on what you change in the file. If you just swap some markup that don't affect any code and the project is published with the "updateable" option, it will not re-compile your solution.

However if you change to much or change inline code, it will need to be re-interpreted / re-compiled, thus your applicaiton will "reset".

Filip Ekberg
  • 36,033
  • 20
  • 126
  • 183
  • Hi, basically I tested, and even adding a literal to page, like single character will cause recompilation and new dll is created in ASP .NET Temp folder, so I don't know how does it relate to what you wrote? – dragonfly Feb 16 '11 at 20:58
5

It depends on how to deployed your application; ASP.NET Deployment

If you deploy simply; copy the application files you have created from your development computer to the production; In this way your application will not be reset only the page .aspx, or the page having the user control .ascx will be compiled.

However in case if you deployed your application by ASP.NET Web Site Precompilation, then it has further options which may affect compilation.

Selecting a Precompilation Model

Well, if you used a precompilation model with UI Update, then changing aspx or ascx will not reset your application, otherwise with other models your application will be reset.

Waqas Raja
  • 10,802
  • 4
  • 33
  • 38
  • Thx, I have precompiled web site, only aspx / ascx pages exist appart from bin folder. However I want to make changes in part of – dragonfly Feb 16 '11 at 09:44
  • Hmm, I found that sentence: "...After deploying the Web site to a production server, changes to the .aspx code can be made without requiring the entire Web site to be recompiled...." here: http://msdn.microsoft.com/en-us/library/ms227430%28v=vs.80%29.aspx .How does it refer to what you have written about precompilation? – dragonfly Feb 16 '11 at 10:05
  • @dragonfly, if you used a precompilation model with Updatable UI then changing aspx or ascx will not reset application – Waqas Raja Feb 16 '11 at 10:30
  • I think I use that configutation, can't rightly say cos I use the "Publish to File System" feature. I only have aspx/ascx + bin folder. No *.cs files. Is there any way to check what switches visual studio uses when publishing? – dragonfly Feb 16 '11 at 10:38
  • @dragonfly, yup if you published without Updatable UI then aspx don't contain any mark up info, there should be only a message. However if the aspx contains markup code then its Updatable UI precompilation model, so your web application will not reset in this way. – Waqas Raja Feb 16 '11 at 10:48
  • Hi, aspx/ascx files contain all markup. Meantime I tested in on test zone: modyfing aspx files for about ~15 time CAUSES application reset (I looked at http://msdn.microsoft.com/en-us/library/fxk122b4.aspx Application Resets counter), but modification to ascx file causes reset straight away. How about that ? :) – dragonfly Feb 16 '11 at 11:10
  • Thx for help, after digging into links and playing with performance counters and file modifications on my own with test app, everything is now clear. – dragonfly Feb 16 '11 at 20:57
  • @dragonfly, but you did not mention; is your application reset by changing aspx or ascx? – Waqas Raja Feb 17 '11 at 10:06
  • Hi, I investigated it using performance counters. Basically my live application had a bug in ascx file, and I wanted to apply quick fix by using JavaScript code. Change in that ascx resulted in 10 recompilations (numRecompilesBeforeAppRestart default value is 15) so my application didn't reset after edit & save. – dragonfly Feb 17 '11 at 21:50
1

Further to Filip's point, if Shadow Copy is enabled, the application will reset only when you recycle the application pool.

http://odetocode.com/articles/305.aspx

sajoshi
  • 2,733
  • 1
  • 18
  • 22
  • with shadow copy there are many other scenario when application reset, but there is concern with only aspx & ascx – Waqas Raja Feb 16 '11 at 10:33
  • if aspx/ascx doen't contain any inline code and the website is not set to "Precompile" - there will be no reset. – sajoshi Feb 17 '11 at 05:47