854

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?

Arsen Khachaturyan
  • 6,472
  • 4
  • 32
  • 36
jjathman
  • 12,156
  • 7
  • 27
  • 33
  • 27
    Are you definitely running as admin? Do you get a User Account Control dialog popup when you launch VS? – Mike Simmons Oct 12 '12 at 13:17
  • 43
    i had the same issue and when i ran VS as administator ( right click and select run as administrator) , it worked – Shyju Oct 12 '12 at 13:22
  • Which version of IIS, Windows? – Jeff B Oct 12 '12 at 13:37
  • Yes, I'm definitely running it as Admin. I right click on it, run as administrator, and get the UAC control before it launches. – jjathman Oct 12 '12 at 14:18
  • 4
    For anyone that comes here later I solved this problem by turning off the IIS and .Net Framework features within Windows 7 and then turning them back on. Somewhere in that re installation it fixed my problem. – jjathman Dec 28 '12 at 16:07
  • 2
    Before you follow any advice posted here, please check if you have pending Windows updates. I had plenty which needed a reboot, finishing the updates fixed the problem. – Thomas Eyde Aug 15 '14 at 08:54
  • @ThomasEyde Thanks, pending updates to Windows 10 caused the error for me. – Y Haber Nov 18 '15 at 23:32
  • http://stackoverflow.com/questions/20984624/visual-studio-2013-you-do-not-have-sufficient-privilege-to-access-iis-web-sites – ravithejag Sep 01 '16 at 15:41
  • If you are on a work computer try: http://stackoverflow.com/questions/28459396/unable-to-access-the-iis-metabase-asp-net/34679243#34679243 – Eduardo Sep 24 '16 at 12:34
  • This has to be one of the strangest VS bugs I've ever seen. Thanks, it did work at least! :D – Mark Pieszak - Trilon.io Nov 07 '16 at 20:43
  • 2
    I had the same problem after Adding feature [from this link](http://stackoverflow.com/a/12860348/5985558) and then I read [this article](http://www.ryadel.com/en/unable-to-access-the-iis-metabase-error-and-how-to-fix-it/) the issue was gone. – JB's Jan 19 '17 at 15:54
  • I'm having this issue and definitely running as Admin. Yesterday it worked - today it doesn't (yes I right click and get user account control dialogue) – niico Mar 22 '18 at 13:19

37 Answers37

1452

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.

Atron Seige
  • 2,010
  • 2
  • 25
  • 31
Gordon Kenyon
  • 14,637
  • 2
  • 10
  • 7
  • 1
    This worked for me too. I found this same information in this [MSDN forum answer](http://social.msdn.microsoft.com/Forums/vstudio/en-US/5e99036c-2c61-41a5-af2e-55ea891fba3c/unable-to-access-the-iis-metabase-you-do-not-have-sufficient-privilege-to-access-iis-web-sites-on). – neontapir Jul 11 '13 at 16:18
  • 44
    It worked, thanks. Just one note, config folder can be located in C:\Windows\System32\inetsrv\config – Alexandr Nikitin Sep 11 '13 at 08:28
  • 1
    Works! Much better than running VS as admin – cguedel Oct 23 '13 at 09:55
  • 82
    %systemroot%\System32\inetsrv\config (i.e. C:\WINDOWS\System32\inetsrv\config) on windows 8.1 works nice – stefano Nov 05 '13 at 08:54
  • 13
    %systemroot%\System32\inetsrv\config was the correct path for Windows 7 – Aidin Nov 11 '13 at 21:02
  • 1
    This allowed me to open the project, but won't debug. It claims IIS doesn't list the website, when it works fine as admin – Patrick Mar 19 '14 at 12:44
  • 44
    @Nate, the problem is that when VS loads the project, it tries to access the IIS metabase, which is in that directory. IIS, on your computer, is locked down under admin privileges. So when you open VS as a normal user, you can't access IIS's metabase and VS can't load the project. (On Windows 7+, you access *everything* as a normal user by default. The problem is that VS won't ask you to elevate your privileges when you need to, so you need to manually grant the permissions to access that directory to yourself.) – PotatoEngineer Sep 05 '14 at 02:33
  • 1
    This happened to me after making a manual change to the machine.config – Induster Nov 02 '14 at 16:38
  • 1
    This does fix it for me, but gives me another one: http://stackoverflow.com/questions/10716956/iis-does-not-list-a-website-that-matches-the-launch-url so launching as admin would be the easiest. – JP Hellemons Dec 23 '14 at 14:45
  • Worked for win8.1 Pro – Oğuz Sezer Jun 01 '15 at 13:24
  • 6
    `%systemroot%\System32\inetsrv\config` for Windows 10, too. – bonh Aug 03 '15 at 18:03
  • In fact, in my Windows 8 it was the "C:\Windows\System32\inetsrv\config" folder... I hope it helps... – Roger Jul 30 '13 at 14:58
  • Worked like a charm!!! Thanks very much. N.B. `%systemroot%\System32\inetsrv\config` also works for Windows Server 2012 R2. Nice!! – Josh Korn Dec 21 '15 at 19:02
  • 1
    Yes, yes, yes, yes and yes. The sad thing is all the time lost messing about with this I'll never get back. – Phil Cooper Feb 29 '16 at 20:23
  • 2
    %systemroot%\System32\inetsrv\config is not valid for Windows 10 64-bit. – Jonathon Cowley-Thom Mar 02 '16 at 12:30
  • @JonathonCowley-Thom Which version is it? in my computer it works fine. (Windows 10 64 bit as well) – Earth Engine Apr 28 '16 at 00:43
  • 2
    I can't find where to 'Change the shortcut back to Run as me', but what I only did was open the Export folder and it worked. – Justin Jun 06 '16 at 03:00
  • It seems after the last Windows 10 update, I needed to do this again. – grokmann Sep 27 '16 at 12:03
  • 1
    This STARTED happening after Microsoft shoved a massive load of updates down my throat on Windows 10. Forcing my way into those two folders did the trick. – Brian Webster Oct 01 '16 at 17:19
  • 1
    Yeah, doing this again seems to be required every time Windows 10 has a major update. – Adam Goodwin Oct 04 '16 at 09:07
  • Nice. I run into this after cleaning up tons of junk user profiles on Win 7. – Whoever Oct 21 '16 at 17:12
  • @JonathonCowley-Thom for windows 10: c:\windows\system32\inetsrv\config – Dario Jun 01 '17 at 09:17
  • I had this error pop up after a Windows 7 -> Windows 10 upgrade. This is, at the time, the first result in Bing and Google searches. This solved my issue immediately; as in I did not have to restart Visual Studio '17. – Fus Ro Dah May 30 '18 at 14:48
252

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

Felipe Ardila
  • 2,936
  • 2
  • 12
  • 12
  • I am definitely running as administrator. I do receive the UAC prompt and it launches successfully from there. I used this with VS2010 as well. – jjathman Oct 12 '12 at 14:26
  • Try this. Put the following on the command prompt. %windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i – Felipe Ardila Oct 12 '12 at 14:46
  • It's general and is not exclusive for your user – Felipe Ardila Oct 12 '12 at 14:47
  • Would that be Framework64 for a 64-bit machine? Also, why not from the v4.x directory? – jjathman Oct 12 '12 at 15:03
  • Yes, I just opened/converted a massive application written in vs 2008, I setup IIS and tried opening and got the permission iis metabase error, so I right click on vs 2012 and opened as administrator and it opened. – Tom Stickel Feb 05 '13 at 01:18
  • I doubt you have local admin rights or your admin has locked you down a little. I had same issue and restarted as admin and it works fine. – Nick Turner Aug 13 '13 at 14:09
  • In Windows 8, you can force Visual Studio 2012 to always run as Administrator using the following method: http://blogs.msdn.com/b/abhiann/archive/2013/02/14/always-run-visual-studio-2012-as-administrator-in-windows-8.aspx – David McClelland Sep 30 '13 at 17:38
  • 13
    If you want to avoid the pain of running your visual studio as administrator every time (which IMHO is a better solution) then check the response by GordonK2004. – Aidin Nov 11 '13 at 21:04
  • 22
    -1 from me.This blog promotes running the IDE as Administrator all the time. This will get you into 101 problems writing correct code that works correctly inside security restricted environments that your users will want/need to deploy into. It is much better to solve each security matter as it crops up in development (as your test each part of the code well) and document the solution needed for users/installer than to turn this Run-as-Administator off just before you roll a release and hope your testers find every security concern you wallpapered over (the cracks). – Darryl Miles Dec 12 '13 at 19:38
  • 5
    @DarrylMiles Care to share a real-world example where doing this caused a security issue? – user247702 Jul 07 '14 at 00:08
  • I AM running as administrator and still get this error. – niico Feb 06 '17 at 11:55
  • 5
    This is an awful answer, real shame that it's been upvoted so far. Running your VS as an admin is a work-around, not a solution. – Jansky Nov 24 '17 at 12:11
53

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

Jeff B
  • 7,565
  • 15
  • 53
  • 128
  • 1
    I tried all the other solutions (config folder permissions, not use IIS, run VS as admin, restart IIS, etc.), but this was the only solution that worked for me. Thanks for sharing! – Chris Knight Nov 25 '14 at 19:14
  • Thanks, this helped me too. I am using VS2013 and the project file's config files structure is different than Bruno Sena's answer. I was about to pull my hair out, but then I remembered I'm bold and opted to try this solution which was a quick fix. – BraveNewMath Apr 01 '15 at 07:25
  • Ensure `IIS Admin service` is started and set Startup type to Automatic instead of Disabled. – Ivan Chau Jun 15 '16 at 03:49
  • 1
    Based how restricted your configuration is this might also need admin priviliges. – surfmuggle Nov 03 '16 at 17:55
34

I resolved this issue by granting IIS AppPool identity permissions to the %systemroot%\inetsrv\config

nhahtdh
  • 52,949
  • 15
  • 113
  • 149
hopkinsrush
  • 441
  • 4
  • 2
29

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.

Jake_
  • 1,225
  • 11
  • 31
nologo
  • 5,015
  • 3
  • 33
  • 47
  • This works for me, but what is the underlying problem here? It must be false on my desktop but true on my laptop. So if I check a project into the TFS on my laptop, it fails to load on my desktop, and vice versa until I change this. – Derek Ziemba Nov 22 '14 at 04:37
  • 5
    How does this help solve the problem of not being able to use IIS? – Jonathon Cowley-Thom Mar 02 '16 at 12:51
  • Setting `False` did not work. The node `true` was present as well. Setting it to false did not help. Still the same error access to iis metabase is needed. – surfmuggle Nov 03 '16 at 18:05
  • This "works" for me and there seems to be confusion on this. Most projects can run under iis express on a person's local machine. Some projects required full IIS. All I needed to do was load the project in VS so I could look at it. If I tried to run it under express it would likely have some kind of run time error. The other developers that actually develop this project and test locally take the time to install IIS locally. So this does not solve the runtime issue. However, someone needs to load it in VS so they can work on it to solve the run time issue so this is a valid answer. – Be Kind To New Users Jun 21 '20 at 13:28
18

I have had two seperate types of problem lead to this error, and thought I'd share...

1. The directory was on an network share and due to UAC restrictions, was 
   unable to be accessed -- even when running as an admin.
2. The directory was on a drive that didn't exist...

Both of these stem from an unfortunate (imo) choice by MS to put things in the Documents or My Document directory, combinee with really lousy error messages. In both of the above cases the fundamental problem was that the IISExpress Config file goes in My Documents, and it either didn't exist or couldn't be accessed.

Community
  • 1
  • 1
jmoreno
  • 12,480
  • 2
  • 50
  • 83
  • How did you solve the problem. I think I'm facing with one the 2 problems. – Tassisto Nov 28 '13 at 08:40
  • Make sure that both the Projects directory and My Documents directory are on a local disk drive. I put them both on C:\. – jmoreno Nov 28 '13 at 20:59
  • 7
    Our VPN dies often and leaves ``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 08:41
  • 1
    The solution for me was to copy the `IISExpress` folder from my Documents folder on another machine to my new machine, and then things started working. – twhitbeck Oct 13 '14 at 12:47
  • Try this: http://stackoverflow.com/questions/28459396/unable-to-access-the-iis-metabase-asp-net – Eduardo Feb 21 '16 at 21:53
  • I was connected into my office's network via a VPN connection, and for some reason I had to first explicitly access stuff on the network drive on which my My Documents folder is located (I did so by clicking on that drive within Windows Explorer, and everything displayed as expected), and then restart Visual Studio 2013, and then all was well. I guess Visual Studio (which I started as Administrator) didn't have as much "power" as Windows Explorer. – ALEXintlsos Mar 05 '16 at 19:56
14

Thank you to everyone that answered. Since this was closed for a long time I couldn't provide much feedback, but I did eventually fix my problem. I tried many of these other solutions and they didn't fix my issue, but I'm sure they help when the root cause is different.

My Solution

I solved this problem by turning off the IIS and .Net Framework features within Windows 7 and then turning them back on. It seems like this re-installation is what fixed my issue. I still don't know what caused the problem, but at least one other developer on my team had the same issue.

jjathman
  • 12,156
  • 7
  • 27
  • 33
14

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.

Neuron
  • 3,776
  • 3
  • 24
  • 44
Jesse Mwangi
  • 161
  • 1
  • 7
  • This has worked for me before as well. Today, trying it on a new laptop, I did not get the security dialog when navigating to the folder, I simply could not get into the config directory at all. I had to right-click and change the permissions on the folder (which required using my local admin access) and give myself permissions, then it worked. – CaseyR Apr 01 '20 at 18:43
13

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

Community
  • 1
  • 1
lnaie
  • 935
  • 10
  • 15
  • No. This will give read-permissions to the IIS configuration _to the web application pool_ which runs as that identity. Visual Studio doesn't run with this identity, so it doesn't help for this question. Further, why would you let the application pool access the IIS configuration? That's asking for trouble. – David Bullock Dec 18 '14 at 04:02
  • 2
    +1 but rather than granting access to the DefaultAppPool, I gave read/write access to my user and that fixed the error. – David Schwartz May 28 '15 at 18:02
  • I did the same as David, except with full control (F) and it resolved my issue. – Bernesto Dec 20 '15 at 21:08
12

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.

sargeMonkey
  • 542
  • 1
  • 5
  • 21
  • We work in a VM, co-worker ended up setting a shared folder which ended up using the "My Documents" folder to a network path. As this answer stated, it does not work without the documents folder. I will check if this folder is available first thing in the future to save the 2hrs we spent going through these posts and such lol. – Tony Feb 18 '16 at 16:50
  • I had this problem also. My **Documents** folder was on a network share and a network issue was preventing access. Once I resolved the network problem Visual Studio stopped giving the IIS Metabase error. – John Mills Apr 03 '18 at 10:26
7

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.
Rushby
  • 807
  • 9
  • 17
  • This will not solve the OP issue because you cannot open the project to change the URL when you get this error. – htm11h Sep 01 '16 at 17:48
  • I partially disagree with @htm11h. I had the OP's error and removed the single entry above (outside of VS). I then ran VS and was able to at least open the properties. It wouldn't let me save the edits though, so I had to open `%systemroot%\System32\inetsrv\config` once and continue as admin; also open `%systemroot%\System32\inetsrv\config\Export` and do same. ([error-unable-to-access-the-iis-metabase](http://www.ryadel.com/en/unable-to-access-the-iis-metabase-error-and-how-to-fix-it/)) – secretwep May 02 '17 at 18:18
  • My comment was that it was not repairable from within VS as you noted. Nice to know that you can directly edit the file though, its was not identified at the time. Most were searching for a reg hack. – htm11h May 03 '17 at 15:13
7

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

Tom Stickel
  • 16,699
  • 6
  • 102
  • 108
6

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.

Saurabh Soni
  • 173
  • 2
  • 9
4

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.

Ramazan Sağır
  • 3,525
  • 1
  • 11
  • 13
3

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.
Community
  • 1
  • 1
KSK
  • 625
  • 4
  • 18
3

Changing this key worked for me:

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

The location didn't exist.

garryp
  • 4,915
  • 1
  • 23
  • 37
  • I had to change the key you mentioned, and **also** `HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Personal`. This was due to the profile path being set to a non-existent directory in Active Directory/Group Policy. – Fiddles Nov 29 '16 at 01:19
  • A third culprit is `HKEY_CURRENT_USER\Software\Microsoft\IISExpress`, which is an override custom dir, and another potential culprit for this problem – Fiddles Nov 29 '16 at 01:21
3

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.

E2rdo
  • 309
  • 1
  • 4
2

I also had a similar problem. My solution is an extension to the answer "Run as admin" which I hope someone might find useful.

I was running VS2012 and almost every time I had to do the Right Click, Run As Administrator. I got tired of this so instead I went into its properties on the shortcut, clicked advanced, and then clicked the "Run as Administrator" option. Now VS2012 always runs as administrator whenever I open it from that shortcut.

The from that shortcut bit is important. I proceeded to branch my project, and download the branch to a new local folder. Then, when I opened it from the shortcut I had no problem. But if I went directly into the folder, and ran the project locally without the shortcut, it did not run as administrator and I got this error.

Once I opened VS2012 as usual first, then using File/Open/Project It worked again no problem. (because I was running as admin). But I wasn't running as admin when I opened the solution using windows file manager.

The other suggestions seem somewhat extreme, but this is pretty simple so I would tend to give this a try first.

Hope this was helpful.

Francis Rodgers
  • 4,305
  • 7
  • 38
  • 61
2

This seems like one of those "All errors lead to this message" type of bugs.

Mine was that the App Pool was just turned off. I turned it back on, and everything worked fine.

Nathan Tregillus
  • 5,248
  • 2
  • 43
  • 73
2

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.

Thomas Eyde
  • 3,660
  • 2
  • 21
  • 30
2

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

scottt732
  • 3,687
  • 2
  • 19
  • 23
  • Note to future me: I updated Windows 10 to a preview release & it broke again. This time I ran the 2x aspnet_regiis and the subst command and am back in business. Oh. And don't forget to wind your watch. – scottt732 Apr 30 '16 at 03:01
1

I just had the same issue with me today. And I found it annoying. Though I have other two websites already under development from the same IIS but still was not able to create new site. Strange, but I did this.

  • Delete the site from IIS
  • Create new site, give it a name "new_site"
  • Select Application Pool other than the site name itself. So it wont be messing up with default settings.
  • Keep IP "unassigned" if you are running it from same machine
  • give it some unused port
  • Run Visual Studio as "Run as Administrator" by right-clicking on VS executable shortcut.
  • You are done!

You do not need to turn off/re-install anything other than what I have stated since it works.

Let me know if anybody had the same issue just like me and solved the same way. I think it was not the issue but a wrong way of creating website on localhost which Visual Studio rejects to open.

I hope this will help newbies.

KMX
  • 2,311
  • 1
  • 21
  • 27
1
  1. Create a shortcut to the "devenv.exe"
  2. select the "Run as administrator" option for the shortcut
  3. doble click on the short cut and reopen your project
1

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

1

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

Community
  • 1
  • 1
JB's
  • 452
  • 9
  • 26
1

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.

Kenmeister
  • 494
  • 2
  • 9
  • 9
1

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

<UseIIS>False</UseIIS>
Arvind Krmar
  • 1,226
  • 1
  • 9
  • 15
0

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.

user2686690
  • 125
  • 1
  • 3
0

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.

JGa
  • 1
0

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.

Yossi
  • 1
0

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.

Ray
  • 5,849
  • 3
  • 42
  • 75
0

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.

Dennis van Dalen
  • 494
  • 3
  • 12
0

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.

0

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

Roman Borovets
  • 720
  • 8
  • 22
0

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
סטנלי גרונן
  • 2,740
  • 21
  • 43
  • 62
0

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.

John Cooling
  • 395
  • 2
  • 20
-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>