Deleting folder no longer causes asp.net application to restart in asp.net 4 -
in asp.net 2, deleting folder cause application restart. today found behavior no longer existed in asp.net 4? can't find info this. can tell me if true? if yes, that's awesome! hate application restart behavior in asp.net 2. can seek this:
debug next code in asp.net webforms (.net 3.5) , you'll grab threadabortexception. when debug in asp.net webforms (.net 4), won't grab exception; fine. think reason why got threadabortexception deleted directory in thread. application restarted, , thread got aborted. (environment: win8, vs2012, iis express)
protected void page_load(object sender, eventargs e) { var thread = new thread(() => { var folderpath = path.combine(appdomain.currentdomain.basedirectory, "app_data\\test"); var filepath = path.combine(folderpath, "test.txt"); if (directory.exists(folderpath)) { directory.delete(folderpath, true); } directory.createdirectory(folderpath); system.io.file.writealltext(filepath, "hello"); seek { var loop = 100; while (loop > 0) { thread.sleep(100); loop++; } } grab (exception ex) { var msg = ex.message; } }); thread.start(); response.write("running"); }
as fas i can see there not difference between 3.0 , 4.0, next action cause app restart:
application restarts
modifying source code of web application cause asp.net recompile source files assemblies. when modify top-level items in application, other assemblies in application reference top-level assemblies recompiled well.
in addition, modifying, adding, or deleting types of files within application's known folders cause application restart. next actions cause application restart: • adding, modifying, or deleting assemblies application's bin folder.
• adding, modifying, or deleting localization resources app_globalresources or app_localresources folders.
• adding, modifying, or deleting application's global.asax file.
• adding, modifying, or deleting source code files in app_code directory.
• adding, modifying, or deleting profile configuration.
• adding, modifying, or deleting web service references in app_webreferences directory.
• adding, modifying, or deleting application's web.config file.
msdn 3.0 asp.net application life cycle overview
msdn 4.0 asp.net application life cycle overview
so guess depends on which folder delete in appliction directory.
asp.net application-restart
No comments:
Post a Comment