Aqui está um trecho de código que irá guiá-lo criando o objeto DirectoryEntry e chamar o método Invoke (...) com o parâmetro adequado para fazer a operação específica com o pool de aplicativos do IIS:
const string APPLICATION_POOL_URL = "IIS://KUNAL-CHOWDHURY.COM/W3SVC/AppPools/BlogPool";
var directoryEntry = new DirectoryEntry(APPLICATION_POOL_URL, USERNAME, PASSWORD);
// call to stop the Application Pool
directoryEntry.Invoke("Stop", null);
// call to start the Application Pool
directoryEntry.Invoke("Start", null);
// call to recycle the Application Pool
directoryEntry.Invoke("Recycle", null);
Fonte: http://www.kunal-chowdhury.com/2013/08/how-to-manage-iis-application-pool.html
const string APPLICATION_POOL_URL = "IIS://KUNAL-CHOWDHURY.COM/W3SVC/AppPools/BlogPool";
var directoryEntry = new DirectoryEntry(APPLICATION_POOL_URL, USERNAME, PASSWORD);
// call to stop the Application Pool
directoryEntry.Invoke("Stop", null);
// call to start the Application Pool
directoryEntry.Invoke("Start", null);
// call to recycle the Application Pool
directoryEntry.Invoke("Recycle", null);
Fonte: http://www.kunal-chowdhury.com/2013/08/how-to-manage-iis-application-pool.html
Nenhum comentário:
Postar um comentário