2

I'm trying to retrieve a website from IIS with following code:

var serverManager = new ServerManager();

var site = serverManager.Sites.FirstOrDefault(s => s.Name == Config.WebSiteName);

ServerManager class is defined in Microsoft.Web.Administration, I'm using reference with copy local and the dll is deployed with the application.

If my app is ran on Win7 64bit it works correctly but when I try to run it on Windows XP 32 it throws an exception:

Retrieving the COM class factory for component with CLSID {2B72133B-3F5B-4602-8952-803546CE3344} failed due to the following error: 80040154

I'm deploying the app as stand alone winforms .net 3.5 application (built for Any CPU).

Any ideas?

Thanks in advance.

1 Answer 1

6

That error is REGDB_E_CLASSNOTREG, i.e. the code it's trying to call doesn't exist on your XP machine. From the docs

Provides read and write access to the IIS 7 configuration system.

Win XP Pro only has IIS 6 not 7. You'll have to use some other mechanism, e.g. iisweb.vbs, adplus or the COM objects they use behind the scenes.

Sign up to request clarification or add additional context in comments.

2 Comments

How did you know that '80040154' meant 'REGDB_E_CLASSNOTREG'?
@BSick7 There's a utility err.exe that maps codes to constants. You can find the latest version in the Windows SDK. I think it's also possible using Visual Studio (certainly VS6 bundled an app that did it) but I'm not sure how. And with a bit of effort you can also dig it out of the header files, although many constants like this are assembled from parts so it can take some effort.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.