My ASP.Net application used to restart unpredictably during requests, ruining my state, session data etc. I determined that the problem was caused by a control that writes and deletes some files in Temp
folder that it creates near bin
folder, so the web directory looks like this:
bin
Temp
....
Default.aspx
web.config
ASP.Net apparently reacts to changes inside Temp
folder the same way it reacts to changes inside bin
or in web.config - it restarts the application.
I could partially solve the problem by moving the Temp
outside the site directory. That way the application doesn't get restarted every time something temporary is written\deleted, so this part works well. The problem is that some of the files inside Temp
directory should be web-accessible - like images generated on the fly and such.
So my question is actually threefold:
- Should ASP.Net application get restarted even if the changes are made not in the
bin
directory, but in another directory at the same level? Or is there something wrong with my configuration? - Where and how do I create a temporary folder so it's web-accessible but it doesn't cause application restart?
- How do I turn off restart on directory change from code or web.config (both in IIS and ASP.Net development server)?