I have created a method to get hosted web sites from IIS server as following code snippet.
ServerManager serverManager = new ServerManager();
try
{
foreach (Site site in serverManager.Sites)
{
Console.WriteLine(site);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}
When i run it in my local machine it's working perfectly(Windows 7 /IIS 7 with 32bits)
.but when i run it in server machine(Windows server 2003 R2 with IIS 6)
it's not working.It gives following Error
Retrieving the COM class factory for component with CLSID {2B> 52-803546CE3344} failed due to the following error: 80040154> d (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
Any help will be great full ?