How to recycle aws server app pool remotely

0

I am trying to recycle the aws app pool remotely using below syntax

using (DirectoryEntry appPoolEntry = new DirectoryEntry(
    "IIS://" + appPoolModel.ServerName + "/W3SVC/AppPools/"+appPoolModel.AppPoolName))
{
    appPoolEntry.Invoke("Recycle", null);
    appPoolEntry.Close();
}

But i am getting this below error

System.Runtime.InteropServices.COMException (0x800706BA): The RPC server is unavailable.

For aws server i am using the server name as follows

"ec2-[Server Public IP].compute-1.amazonaws.com"
c#
amazon-web-services
asked on Stack Overflow Dec 31, 2014 by user2919069 • edited Dec 31, 2014 by Uwe Keim

1 Answer

0

There couple of reason for this.

  1. One obivious reason that shown in error that RPC server is actually not running.

  2. If RPC server is running you have to check the firewall port open for RPC. http://support.microsoft.com/kb/178517

  3. Context of user in which your code is executed. Support you run in context of user1 and it does not have permission for DirectoryEntry object then it might fail.

if This is not possible then try to do it via Remote Powershell.

https://social.technet.microsoft.com/Forums/windowsserver/en-US/b24d5b03-343c-47b5-937e-aa47664cdfb2/how-can-i-restart-an-iis-webapppool-on-a-remote-server-in-powershell?forum=winserverpowershell

answered on Stack Overflow Dec 31, 2014 by dotnetstep

User contributions licensed under CC BY-SA 3.0