When i am connecting to the remote iis server for retreiving all the sites list from that server, it gives the error as "Retrieving the COM class factory for remote component with CLSID {XX} from machine Y.U.Y.U failed due to the following error: 80070005".
my code is,
using Microsoft.Web.Administration;
using (ServerManager serverMgr = ServerManager.OpenRemote("Y.U.Y.U"))
{
foreach (Site site in serverMgr.Sites)
{
string sitename = site.Name;
Console.WriteLine("\n\nSite name : " + sitename);
long siteid = site.Id;
Console.WriteLine("site id : " + siteid);
string sitestatus = site.State.ToString();
Console.WriteLine("site status : " + sitestatus);
}
}
Note: The ip "Y.U.Y.U" has a username, and password.
1. how can i resolve this error.
2. is i need to pass the username and password as a parameter? if yes, please help me to do it.