IIS 5 & IIS 6
Problems recycling Application Pool from codebehind
Last post Aug 21, 2009 07:07 AM by Leo Tang - MSFT
Aug 17, 2009 11:39 AM|mjepson|LINK
I am trying to recycle an application pool from code. This is needed, because resource files are altered using a CMS for the website, which will only show after the app pool is recycled.
I have found the code at http://www.leandrodg.com.ar/blog/2008/02/find-and-recycle-current-application-pool-programmatically-for-iis-6/ to be helpful, but it keeps confronting me with the following:
Acces is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
The application pool is running on a user account, so we can use the login for access to the SQL server using integrated security. I have tried adding the user to the administrators group and Super Users group, with no success.
Any idea how I can recycle the app pool from code or how I can get my code to work (i.e. what permissions do I set and how).
Thanks in advance!
Aug 17, 2009 09:53 PM|WWWWeb|LINK
Aug 18, 2009 04:45 AM|mjepson|LINK
I have added the user under who's account the Application Pool runs to the admin group, but still no success.
Aug 21, 2009 07:07 AM|Leo Tang - MSFT|LINK
Please check system event log in the .event viewer. There should be some events about W3SVC, the detailed information of the event description will help us to determine the root cause.
Additionally, set the application pool identity as an admin user account is not recommended. You can temporarily impersonate this account for the specific request in code. For more detailed information, please look at the figure 2 in the following article:
How To: Use Impersonation and Delegation in ASP.NET 2.0