Sunday, April 10, 2011

"Failed to access IIS metabase" Error

I was working on a sample web project, where in I came across this error "Failed to access IIS metabase". This happened only when I tried to run the web project by "Using Local IIS Web Server" instead of the default "Use Visual Studio Development Server".  From the Error I was able to find out it is something related to IIS web server only. When I tried to dig into this issue, I understood this is because of my IIS installation. I installed IIS web server after installing my ASP.NET framework.

I got few suggestions to fix this error first one was 
 "To repair framework from the Add/Remove programs" : But for some reasons this did not work

Next suggestion was
  "To Register ASP.NET on IIS" . 
Registering ASP.NET on IIS is not just a matter of associating the various .aspx, .asmx, .axd, .ashx and the other ASP.NET extensions to the aspnet_isapi.dll ISAPI, more has to be done to create the ASP.NET account and to set it for ASP.NET requests, register the ISAPI itself and other stuff.

To do this we will have to use the aspnet_regiis utility
1. Click Start -> run -> cmd - ENTER
2. At the command prompt, type the following, and then press ENTER:
"%windir%\Microsoft.NET\Framework\<version>\aspnet_regiis.exe"
-i
  
Here version is the version number of the .NET Framework that are installed on our server

   -i is the register the .NET Framework 
   -u is to unregister the .NET Framework

We will have to do this for all the versions installed on the server. I did the following

"%windir%\Microsoft.NET\Framework\v1.1.4322\aspnet_regiis.exe" -i
"%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe" -i
"%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe" -i

My IIS web server started working!!!

How do you test Microsoft Visual Studio .NET Installation

1. Take a Sample aspx file, Let us say "test.aspx" And copy that to "c:\Inetpub\wwwroot" folder
2. Now open browser and type http://localhost/test.aspx: You should be able to see the page if your Microsoft Visual Studio .NET installation is right. aspx programs need the .NET framework to run. The .NET framework is one of the Windows component updated by the Microsoft Visual Studio .NET installation

How do you test IIS Installation

1. Take a Sample HTML file, Let us say "test.html" And copy that to "c:\Inetpub\wwwroot" folder
2. Now open browser and type http://localhost/test.html: You should be able to see the page if your IIS installation is right