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

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.