Error: Failed to access IIS metabase. Hosting WCF Service in IIS

This error ("Failed to access IIS metabase") can occur when you try to access your WCF when you have added for hosting within IIS.

To solve this problem do this:

  1. Reregister ASP.NET for IIS:  Open an Visual Studio Command Prompt (or a regular command prompt and cd into the .Net dir - usually: C:\WINNT\Microsoft.NET\Framework\v2.0.50727) then type:
       aspnet_regiis -i
  2. When complete, from the same command prompt run: iisreset

Verify your IIS virtual/app dir is setup correctly (uses .Net 2).  If you don't already have one...

To Host a WCF Service within IIS:

  1. Develop your service in IIS (I'm not going to tell you how to do that!) and build it.
  2. Within your computer management/MMC console (compmgmt.msc), open the Internet Information Service node and right click on the site you want to use and select New - Virtual Directory...
  3. Enter the name you want.
  4. Point this to the directory you created your WCF service project in (the project root dir - not the bin dir).
  5. Complete the wizard then back in the MMC window right click on your new virtual dir and select Properties.
  6. On the ASP.NET tab make sure uses version 2.0.50727 (or whatever your v2 is).

To test:  within the MMC console - open your new virtual dir, right click on one of your services (eg MyService.svc) and select Browse.

HTH

Tim

This article is part of the GWB Archives. Original Author: Tim Huffam

New on Geeks with Blogs