Failed to access IIS metabase

Recently reinstall IIS on my computer, since then I didn’t use my localhost websites. however today, I’m finally having problem with the IIS when I tried to open a local website, I got this message below:

Failed to access IIS metabase.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase.
The process account used to run ASP.NET must have read access to the IIS metabase (e.g. IIS://servername/W3SVC). For information on modifying metabase permissions, please see http://support.microsoft.com/?kbid=267904.

spent half day trying to get my local website to work, and after trying with many things, finally got the answer below.

1. Go into “C:WINDOWSMicrosoft.NETFrameworkv2.0.50727”
2. Run “aspnet_regiis -i”

Apparently when install IIS AFTER .NET 2.0 framework, the rights of the ASPNET user had not been set correctly. Running this script will install the set the registry properly.

If you have a similar problem, give this a try.