jjathman
jjathman

Reputation: 12624

Error - Unable to access the IIS metabase

After installing Visual Studio 2012 and opening my solution I get a series of errors in this form:

The Web Application Project Foo 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.

I get this for each of our web applications.


Things I have tried:

  1. Running Visual Studio as Administrator
  2. Running aspnet_regiis.exe -ga MyUserName
  3. Running aspnet_regiis.exe -i

These seem to be common solutions for this problem but I have not had any success with them.

Is there anything else I can try to do?

Upvotes: 869

Views: 378404

Answers (30)

Arvind Krmar
Arvind Krmar

Reputation: 2612

In Visual Studio 2015: I changed UseIIS in .csproj file to false and it worked for me.

<UseIIS>False</UseIIS>

Upvotes: 1

Tom Stickel
Tom Stickel

Reputation: 20421

You might run across this problem and have same problem as me. I "solved" it before and then power outage and computer crashed, not sure why a registry setting reverted but it is the SOURCE of my problem.

  1. I tried all the running as adminstrator
  2. All the IIS / IIS express re-installs.
  3. Various "hacks"

Came down to having to fix the registry again.

  1. Could not as administrator even open regedit (Need to access registry since problem is not with gpedit.msc admin template )

  2. UnHookExec.inf on desktop

Just save UnHookExec.inf and install it by right clicking and selecting install. Installing the file will not show any popup or notice box. http://www.tweakandtrick.com/2011/04/enable-regedit-registry-editor.html

  1. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal pointing to non-existant fileshare. Changing that to local path solved this problem for me. – Pasi Savolainen Jul 14 '14 at 8:41

(changed from \\cs2data\home\stickelt\my documents to c:\dev )

Now ALL is good and Visual Studio opened solution with 15 projects and connects to IIS and does not complain about not being able to access iis metadata

I had never ran into this before, as nobody at current job had this problem ( many have been here a long time, some got clones of other machines that "worked" and many are on another domain etc.. )

Upvotes: 7

Jesse Mwangi
Jesse Mwangi

Reputation: 155

Navigating to folder: %systemroot%\System32\inetsrv\config presents a security dialog. Click continue and this may resolve the issue. This has worked on two separate Win 10/VS 2017/IIS machines.

Upvotes: 14

John Cooling
John Cooling

Reputation: 415

IIS Express Users - Using My Documents on a Network Share

If your IIS Express application.config is located on a network drive, ensure that the drive is mapped and connected in My Computer.

I was facing this issue and when I re-mapped the network drives in My Computer the issue was resolved.

Upvotes: 0

user3921752
user3921752

Reputation:

Open visual studio command prompt and type below command and run

aspnet_regiis -ga machinename\ASPNET

After running the above command Reset the IIS and test the application that resolve your issue.

If above command doesn’t resolve your problem then try to run below command in visual studio command prompt:-

aspnet_regiis -i

Alternatively we can run above command from our windows command prompt also

Go to the Start menu and open Run and enter and click OK

%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe –I

After that Reset the IIS and test the application that resolves your issue

Upvotes: 1

Dzianis Prokharchyk
Dzianis Prokharchyk

Reputation: 19

Run command:

c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -ga %username%
c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

Upvotes: 0

Roman Borovets
Roman Borovets

Reputation: 858

In my case, only thing that helped me is to re-install (or repair is easier) IIS 10.0 Express

Upvotes: 0

Felipe Ardila
Felipe Ardila

Reputation: 3004

I think you are not running visual studio with administrator permissions. Look that:

http://bloggingabout.net/blogs/rick/archive/2012/10/04/unable-to-access-the-iis-metabase.aspx

To quote

The solution to this is simple: start your Visual Studio with "Run as Administrator". You can do this by right clicking the shortcut and selecting "Run as Administrator".

Upvotes: 257

E2rdo
E2rdo

Reputation: 407

Go to the root directory of your project and find the following file:

YourProjectName.csproj.user - inside it, make sure UseIISExpress is set to false:

<UseIISExpress>false</UseIISExpress>


If that alone doesn't work try the following as well and try again:

YourProjectName.csproj - inside the main project file, make sure both UseIIS and UseIISExpress are set to false:

<UseIIS>True</UseIIS>
<UseIISExpress>false</UseIISExpress>


After changing these I was able to load the project again.

Note: Make sure you run your VS as an Administrator, as mentioned in the other answers.

Upvotes: 3

Kenmeister
Kenmeister

Reputation: 514

I did a repair of Visual Studio 2015 to solve this. The repair took a long time, but it solved the issue while doing much of the above did not. I am running Win 7 enterprise.

Upvotes: 1

JB&#39;s
JB&#39;s

Reputation: 626

I had the same problem after Adding feature from this link afterward I followed this article the issue was gone.

Upvotes: 1

nologo
nologo

Reputation: 6328

If you are working on a project which does not require the use of IIS, then a workaround to open the project with this error is to simply right click on the unloaded project and click edit, search for:

<ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="">
        <WebProjectProperties>
          <UseIIS>True</UseIIS>
        </WebProjectProperties>
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>
</Project>

and set USEIIS to false

<UseIIS>False</UseIIS>

reload the project by right clicking on it after saving changes.

Upvotes: 34

Jeff B
Jeff B

Reputation: 9002

I think we encountered a similar problem at work. For us, the solution was to go into Control Panel -> Programs and Features -> Turn Windows Features on or off... inside that, we had to select Internet Information Services -> Web Management Tools -> IIS 6 Management Compatibility -> IIS Metabase and IIS 6 configuration compatibility. Windows Features dialog showing IIS Metabase option

Give that a try and let me know if it helps!

Note: We're running IIS 7.5 on Windows 7 using both Visual Studio 2005 and 2010 and doing stuff with super-old-school WebServices (.asmx)...

Upvotes: 58

scottt732
scottt732

Reputation: 3937

I tried everything above. The credit goes to all of the responses above. Having tried all of the suggestions on their own, I just assembled this combination of suggestions in an order that made sense to me. Note my Documents folder is on a shared drive. The subst/IISExpress stuff is not applicable unless you're in the same boat.

  • Configure VS to run as admin
  • Uninstall IIS via Add/Remove Programs, Windows Features
  • Reboot
  • Run WinRAR or something similar as admin and archive C:\windows\system32\inetsrv\
  • Run cmd as admin and rmdir /s c:\windows\system32\inetsrv\ to completely remove all traces of the last install. Leave elevated cmd prompt open for later.
  • Reinstall IIS with IIS 6 Metabase compatibility (doubt this was necessary)
  • Leave Default AppPool and Default Website as-is (I had previously deleted both)
  • Ran C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ga MYDOMAIN\scottt732
  • Ran C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i

Also, because my Documents folder is on a share drive, I was having IIS Express issues. I don't use/like IIS Express, but Visual Studio complained about it.

  • From elevated cmd prompt, ran subst U: c:\Temp. Created C:\Temp\Documents\ and copied the IISExpress folder from my U drive.
  • Created CustomUserHome key in HKCU\Software\Microsoft\IISExpress with C:\Temp\Documents\IISExpress
  • This allowed me to get Visual Studio to open my web projects and edit the properties. I tweaked the projects to store web server settings in a user file and adjusted it to use a Custom URL (not sure if this was necessary)
  • I may/may not have to run the subst command each time I restart. Don't care.

And after throwing in the towel 3 times and spending roughly ~6 hours I can open web projects in Visual Studio (2015 Update 2).

Upvotes: 2

Rushby
Rushby

Reputation: 889

I came across this today and fixed the problem by removing the IISUrl from the Project file:

  1. Right click project
  2. Click Edit
  3. Delete the following line:

     <IISUrl>http://localhost:xxxxx </IISUrl>
    
  4. Reload project

  5. Now add a new IIS virtual directory by right clicking Project > Properties > Web and selecting Use Local IIS Web Server (Uncheck Use IIS Express) and clicking the Create Virtual Directory button.

Upvotes: 8

Jonathon Cowley-Thom
Jonathon Cowley-Thom

Reputation: 116

I experienced this on a Windows 10 Professional 64-bit machine, and none of the other answers posted here helped. It began happening after I experienced a blue-screen-of-death, and I discovered that UAC had switched itself back on. Running Visual Studio as Administrator alone was not the solution, as my source control was on a network drive, which Visual Studio could not access with UAC on.

Turning UAC back off via GPEDIT fixed the problem.

Upvotes: 0

Gordon Kenyon
Gordon Kenyon

Reputation: 14727

On Windows 8 Pro:

%systemroot%\inetsrv\config

On Windows 7 and 8.1 and 10

%systemroot%\System32\inetsrv\config 

(Where %systemroot% is usually C:\Windows)

Navigate to the appropriate location above in Windows Explorer. You will be blocked access with a popup which says:

"You don't have access to this folder - Click continue to permanently get access to this folder"

Click 'continue' for this folder, and with the Export folder underneath. I changed the shortcut back to "Run as me" (a member of the domain and local administrators ) and was able to open and deploy the solution.

Upvotes: 1461

Ramazan Sağır
Ramazan Sağır

Reputation: 5173

If you have administrator permissions, Right Click to Visual Studio icon > properties and then advanced, "Run as administrator" check. You can run visaul studio as administrator directly anymore. This way, formal and so basic.

Upvotes: 4

Dennis van Dalen
Dennis van Dalen

Reputation: 619

I had the same problem. For me it was that I was using the same my documents as on a previous Windows installation. Simply removing the IISExpress folder from my documents did the trick.

Upvotes: 0

garryp
garryp

Reputation: 5776

Changing this key worked for me:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal

The location didn't exist.

Upvotes: 3

Bruno Sena
Bruno Sena

Reputation: 1

Create a new WebSite, after error go to folder where you created a project, in a txt app open the .csproj file, find this tag "<UseIIS>" and change "false" to "true", in lines bellow find the tag "<IISUrl>" then put the iis url(find url in iis), your tags must be like this:

<WebProjectProperties>
      <UseIIS>True</UseIIS>
      <AutoAssignPort>True</AutoAssignPort>
      <DevelopmentServerPort>0</DevelopmentServerPort>
      <DevelopmentServerVPath>/</DevelopmentServerVPath>
      <IISUrl>http://localhost/yourIISAppAlias
      </IISUrl>
      <NTLMAuthentication>False</NTLMAuthentication>
      <UseCustomServer>False</UseCustomServer>
      <CustomServerUrl>
      </CustomServerUrl>
      <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
    </WebProjectProperties>

Upvotes: -1

sargeMonkey
sargeMonkey

Reputation: 696

I had this problem - the symptoms were the same, but the issue I had was that I had set the "My Documents" folder to be on a network share, and the share was not accessible.

The root problem was that the IIS config files located at %USERPROFILE%\Documents are not accessible. Once I changed the "My Documents" folder location (I modified the reg value), it started working again.

I know that this may not be a common scenario that you might run into, but I've posted it here because it gives the same symptoms.

Upvotes: 12

lnaie
lnaie

Reputation: 1047

On a windows 81, from an admin command prompt, use:

icacls "C:\Windows\System32\inetsrv\config" /t /grant "IIS AppPool\DefaultAppPool":(R)

Then go back in VS, right click on the failed project, choose Reload.

Credit to: IIS7 Permissions Overview - ApplicationPoolIdentity

Upvotes: 13

Ray
Ray

Reputation: 8871

You can solve this problem by actually unchecking the IIS tools in your Windows feature list. Then, repair your Visual Studio 2013 installation and make sure Web Developer is checked. It will install IIS 8 with which VS will work nicely.

Upvotes: 0

Thomas Eyde
Thomas Eyde

Reputation: 3934

One more thing you could try:

  • Check if you have pending Windows updates.
  • If you do, please reboot before trying anything else.

I tend to never shut down my machine, so I had plenty of them waiting for a reboot. And that fixed it.

Upvotes: 1

Yossi
Yossi

Reputation: 1

I'm using Win 8 Pro and VS 2013. After trying everything in this page... I simply reinstalled IIS Express 8 and everything works fine now (even without running as an admin).

My conclusion is that this is a rather generic error and there are multiple root causes.

Upvotes: 0

JGa
JGa

Reputation: 1

I had a similar problem. Visual Studio would not load any web projects and showed the error: creation of virtual directory <myproj:myport> failed. Unable to access the IIS metabase.

In my case it was actually IISExpress that was at the root of the problem. Right clicking on IIS Express in Programs and Features in the control panel and choosing repair fixed the issue in less than two minutes.

Upvotes: 0

KSK
KSK

Reputation: 695

In addition to the answer by @nologo, I also had to use IIS. So I changed the

<UseIIS>True</UseIIS>

to 'False' first.

  • Opened the solution and ensured that the project could be loaded.
  • Close solution and that instance of Visual Studio
  • Change the value to 'True' again
  • Open the solution. This time, I didn't get any error/warning. I could also run with Ctrl+F5 or F5 without any problem while my project was mapped to an IIS website.

Upvotes: 3

Saurabh Soni
Saurabh Soni

Reputation: 337

I just had this issue today and I found that I didn't open VS as 'Run as Administrator'. After doing this, I was able to publish the Service.

Upvotes: 6

user2686690
user2686690

Reputation: 215

In my message, beside complaining about "Unable to access the IIS metabase", it also mentions can't access "<IISUrl>http://localhost:6416/</IISUrl>". Right click on the unload project, click Edit, find the line "<IISUrl>http://localhost:6416/</IISUrl>", comment it out. Reload and it should work. This has to do with administrator doesn't have permission to access that address.

Upvotes: 0

Related Questions