I am trying to add site binding programmatically. Here is my code:
using (ServerManager manager = ServerManager.OpenRemote("serverName"))
{
manager.Sites["siteName"].Bindings.Add(string.Format("*:{1}:{0}.localhost", clientCode, port), "http");
manager.CommitChanges();
}
I am getting the following Error. How do I get around this?
UnAuthorizedException: Retrieving the COM class factory for remote component with CLSID {} from machine failed due to the following error: 80070005
The account runs the code must be the administrator of the remote machine and also the DCOM related ports on the remote machine must be opened at firewall.