13
votes

An ASP.NET web project loads with up the solution, but I get this error

The Web Application Project is configured to use IIS. Unable to access the IIS metabase. You do not have sufficient privilege to access IIS web sites on your machine.

How can this be solved?

9
have you tried this aspnet_regiis -i in command prompt for visual studioDeveloper
Nope. Not sure where or how to do that. Did not know VS had command promp.Amanada Smith
try as per below in ur command prompt c:\windows\microsoft.net\framework\v2.0.50727\aspnet_regiis.exe -ga ASPNETDeveloper

9 Answers

33
votes

This may have nothing to do with registering ASP/IIS. The reason is exactly what the error message says: Visual Studio devenv.exe is not running with sufficient privileges to access the IIS process, and it needs to do this if your solution contains a web project whose Web settings say to use IIS rather than the VS dev server.

There are two solutions to your problem:

  1. Run VS as an Administrator and reopen the solution/project.
  2. Edit the web application's project file with a text editor and change this line from True to False:

     <UseIIS>True</UseIIS>
    

That will stop it using IIS and demanding higher privileges.

The reason VS demands Admin privileges is, I believe, because it will try and create the IIS web site for you on demand if it doesn't exist.

11
votes

An answer that worked for me can be found here:

https://stackoverflow.com/a/17460774/3005965

Basically, go to %systemroot%/inetsrv/config. When prompt appears saying you need admin privileges, click Continue.

This should clear up your issue.

7
votes

Just try to access Visual studio as Admin right click and choose run as administrator. may fixes this problem. and take a look at this link for instructions on creating a shortcut.

4
votes

I ran into this problem when I had copied a project to a new project. I opened the project file (.csproj) and removed the value from the IISUrl element:

from: <IISUrl>http://localhost:21222</IISUrl>

to: <IISUrl></IISUrl>

2
votes

Have you registered the .NET framework with IIS? You need to run the aspnet_regiis.exe utility found at %WindowsDir%\Microsoft.NET\Framework\vx.y.zzzz\. Run it as administrator as follows:

aspnet_regiis.exe -i 

-i : Installs the version of ASP.NET that is associated with Aspnet_regiis.exe and updates the script maps at the IIS metabase root and below. Only the script maps for applications that use an earlier version of ASP.NET are updated. Applications that use a later version are not affected.

Find out more about the utitlity here.

1
votes

This error also occurs if you modified your Machine.config and added some "invalid lines": For example, I added some appSettings, to the configuration section (which IIS didn't like).

0
votes

Just register your Web-project in your local IIS. All the settings you will find in *.csproj file. That works for me.

0
votes

first uncheck internet information service from turn windows features on or off. then uninstall iis from your system and restart it. after restarting it install iis again from https://www.microsoft.com/en-us/download/confirmation.aspx?id=34679 and try to open again.

0
votes

Step 1: Close Visual Studio

Step 2: Go to Project Folder and find ".vs" folder Note: It may be hidden

Step 3: Delete ".vs" folder

Step 4: Open Project Again