Error - Unable to access the IIS metabase

2019-01-03 07:29发布

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?

标签: c# .net iis
30条回答
Juvenile、少年°
2楼-- · 2019-01-03 07:59

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

查看更多
相关推荐>>
3楼-- · 2019-01-03 07:59

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

查看更多
Fickle 薄情
4楼-- · 2019-01-03 07:59

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.

查看更多
Ridiculous、
5楼-- · 2019-01-03 08:00

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.
查看更多
闹够了就滚
6楼-- · 2019-01-03 08:01

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.

查看更多
时光不老,我们不散
7楼-- · 2019-01-03 08:01

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.

查看更多
登录 后发表回答