June 24, 2006

Getting Visual Studio 2005 and IIS 5.1 to Play Nice

Visual Studio 2005The other day I installed Visual Studio 2005 on one of my workstations and proceeded to create an ASP.NET web service. For the most part the Casinni webserver that's built into Visual Studio served my testing needs. But I eventually reached a point where I wanted to run the application on IIS just to make sure it encountered no problems in the target environment.

IISSo I installed IIS 5.1 on my Windows XP box and created a virtual directory containing the project. I set IIS to run it as an ASP.NET 2.0 application and was greeted with this error message when I browsed to the .asmx file:

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).

I was referred to a Microsoft Knowledge Base article. The problem supposedly happened because the ASP.NET worker process didn't have permissions to the mystery that is the IIS metabase. My guess is that this ocurred because I installed IIS after I installed Visual Studio. Microsoft recommended running the following command line as a remedy:

aspnet_regiis –ga [WindowsUserAccount]

I substituted ASPNET (the ASP.NET account on Windows XP) in for [WindowsUserAccount]. Unfortunately this did not solve the problem and I continued getting the same error mentioned above.

After searching some forums I found others who had encountered this issue who advised reinstalling the .NET 2.0 Framework. I went ahead and did this as follows and it resolved the incident:

  • Run the Visual Studio 2005 Disk

  • Select "Change or Remove Visual Studio 2005"

  • Choose Repair/Reinstall

2 comments:

Another Dawg said...

Thanks for the tip. Repairing .NET 2.0 did the trick for me too. Just used Repair from Add/Remove Programs - Change/Remove - "Repair .NET 2.0 Framework to it's original state" option. That metabase looks like no-man's land to me.

allangray said...

I had a similar issue with VS 2008 and I ended up resolving it in the same manner you did, however I believe it is possible to just download the version of the .NET framework that comes with VS (3.0 for 2005, 3.5 for 2008) and install that. It performs a reregistration for you and according to online documentation, that's all you need.

Reinstalling VS performs a reregistration of the .NET framework and supposedly it's this step and this step alone that fixes the problem you get when installing IIS after VS.