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"
There couple of reason for this.
One obivious reason that shown in error that RPC server is actually not running.
If RPC server is running you have to check the firewall port open for RPC. http://support.microsoft.com/kb/178517
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.
User contributions licensed under CC BY-SA 3.0