I was told that every time I refresh our web site, either individual pages or the entire site, I should first stop the application pool, update my website file or files, then start the application pool. My web site files consists, of HTML, JS, ASPX, INC, GIF, JPEG, CONFIG, etcetera. I'm asking because I believe I have updated my site without stopping the application pool and starting it, and also by stopping and starting it, just trying to find out what the correct approach should be.

Thanks Frank DiJohn

有帮助吗?

解决方案

In general the answer is no, you do not need to do that, however it ultimately depends on exactly what Application Platform you use. Based on the question I can see that you use ASP.NET so for that you absolutely do not need to do that since the AppDomain (ultimately where the code runs inside the Application Pool) will do the right thing and no need to do anything further.

The few cases where you want to recycle it is when for example you load DLLs or some files that for whatever reason they might get blocked and prevent you from updating them. In that case stopping the app pool will release the locks so you don't risk failures on that.

I would also recommend looking at using a file called app_offline.htm in your production environments that will provide a better experience for your customer since they might run into intermittent issues as you are uploading/replacing files in your server, for example, imagine you are replacing a DLL with a new version that depends on another DLL that hasn't been updated yet (still being copied), then a new request could get weird exceptions or error messages that you do not want your users to see. By adding that file it will make sure that users see a "please try again, or something" and not these intermediate state.

http://weblogs.asp.net/scottgu/archive/2005/10/06/426755.aspx

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top