tags:

views:

329

answers:

2

How can I restart IIS 6 's defaultAppPool when I click a button of a webform page in an asp.net web app.

I tried to use HttpRuntime.UnloadAppDomain(); but it can not restart the IIS 6 's defaultAppPool.

+3  A: 

Restart IIS application pool from ASP.NET page

Wael Dalloul
When I try this, it occurs the error: HRESULT:0x80070005 E_ACCESSDENIED System.Reflection.TargetInvocationException System.UnauthorizedAccessException
Mike108
A: 

If you need to restart the ASP.NET application; just write some blank lines at the end of web.config; it will automatically restart the ASP.NET application. This technique doesnt require special/administrative permissions!

Khurram Aziz
This will restart the AppDomain for the site but not the worker process. You need elevated rights and trust to be able to restart an Application Pool's worker process.
Kev