Unable to access the IIS metabase ASP.Net
Asked Answered
H

6

12

Hi I know there are a few threads on this but none of the solutions seem to work for me.

I have an ASP.Net website project which I am trying to load and publish in Visual Studio. However when I load the project I get the error:

Creation of the virtuald directory http://localhost:xxxx failed with the error: Unable to access the IIS metabase. You do not have sufficient privilege to access IIS web sites on your machine.

This error only occurs when I run Visual Studio as Administrator. If I don't run as admin then the above error does not occur but when I try to publish my app I get:

Please launch Visual Studio under administrator mode to perform this deployment action

It seems I can't win!


What I've tried so far:

  • Taking ownership of C:/Windows/System32/Inetsrv/Config
  • Setting <UseIISExpress>false</UseIISExpress> in my project_name.csproj file
  • Go back to and old team foundation server check in that didn't have the problem in admin mode and use that configuration.
  • Running Visual Studio as non-admin (works but note second error above)

None had any luck so far.


Extra Info:

Operating System: Windows 8.1 (64 bit)

Visual Studio: 2013

IIS: 8.5

Permissions on C:\Windows\System32\inetsrv\config (read only):

  1. Me: Full control
  2. Administrators: Full control

Permissions on Documents/IISExpress/config (read only):

  1. Me: Full control
  2. Administrators: Full control

Note "Documents" is on a network drive

Harrow answered 11/2, 2015 at 16:28 Comment(3)
Have you tried it where Documents isn't on a network drive?Moncton
@Moncton I wouldn't know how to set it up so it wasn't.Harrow
Possible duplicate of Error - Unable to access the IIS metabaseSpoonfeed
H
36

It turns out my Personal Folder was set to a network drive which occasionally went down causing the error described.

To change your Personal folder:

  • Open C://Windows/regedit.exe
  • Navigate to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
  • Change the field Personal to %USERPROFILE% or %USERPROFILE%\{a folder of your choice}

This fixed the problem for me.

Note you may need to move over any files from your old Personal folder to your new one as they wont be picked up any more

Harrow answered 8/1, 2016 at 14:20 Comment(6)
you saved my dayWigfall
In my case, the personal folder had changed. It was mapped to a network location that was accessible as N:\Documents\, but the registry key User Shell Folders referred them with the corresponding UNC-path. When that was changed, the registry was not updated accordingly. I changed them to N:\Documents and that works for me.Centesimo
For me it was also the network drive! I didn't have to edit the registry, though. I just went to the (network mapped) documents folders properties and on the path tab there was a restore button. Clicking it solved the metabase problem.Silici
Thank you so much, Edd. The whole company network is down at the moment, so I tought I could work on my ASP.NET application offline, but it didn't work until I changed the "Personal" folder path from some UNC path to "C:\users\kh"Billion
After 3 days of trying out every damn possible solutions out there, this is what worked. Thanks a tonne !! How did you even find this out? i mean are there logs to look for to narrow it down to this?Token
@Token There wasn't, I just had a eureka moment when the network went down and I needed to access it for something else. Glad it helped.Harrow
K
3

Have you tried the following fix ?

Here is the Fix that worked.

"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 Metabse and IIS 6 configuration compatibility.

https://social.msdn.microsoft.com/Forums/en-US/1d5cb9c7-af77-4bcd-8421-e813aff88bd3/help-with-visual-studio-2012-error-unable-to-access-the-iis-metabase?forum=visualstudiogeneral

Koehn answered 24/2, 2015 at 15:19 Comment(0)
C
1

I had the same problem after I mistakenly Cut and Pasted my Documents, Downloads and Desktop folders to my external hard drive, it changed the path of the folders to the F: drive (the external hard drive), I copied the folders back and set the path back to local.

  • Copy the items back to C:\Local Disk\Users\your_name
  • Right click on the folder (that isn't working) and click Properties e.g Documents
  • Click on the Location Tab
  • Change the location to normal e.g C:\Local Disk\Users\your_name\Documents

This is what worked for me :D

Coppery answered 18/1, 2017 at 9:42 Comment(1)
Had the same issue. Thanks for pointing me in the right direction.Dissatisfactory
C
0

Maybe a shot in the dark - but have you tried installing the 'IIS Management Console', 'IIS Management Scripts and Tools' and 'IIS Management Service' from Add/Remove Programs - Turn Windows Features On or Off? That may help.

Compressive answered 19/2, 2015 at 16:0 Comment(1)
Yep I did that after installing Visual Studio. No luck :(Harrow
M
0

Left click on your project --> properties. Select WEB. Check the link [port] on project url. Click Create Virtual Directory. Should help.

Musgrave answered 23/2, 2015 at 18:45 Comment(1)
I set the host & port to localhost:21000, created the virtual directory (whilst running visual studio as a non admin) which worked fine. Still need to be an admin to deploy though. If I run as admin I cant even load the project, as a result right clicking on it in VS doesn't show a "properties" option in the context menuHarrow
R
0

Step 1: Close if Visual Studio Opened.

Step 2: Open Project Folder and find ".vs" folder, it may be hidden

Step 3: Delete ".vs" folder

Step 4: Open Project Again

R answered 25/6, 2018 at 5:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.