C# 错误 - 无法访问 IIS 元数据库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12859891/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error - Unable to access the IIS metabase
提问by jjathman
After installing Visual Studio 2012and opening my solution I get a series of errors in this form:
安装Visual Studio 2012并打开我的解决方案后,我收到了以下形式的一系列错误:
The Web Application Project Foo is configured to use IIS.
Unable to access the IIS Metabase. You do not have sufficient privilege to access IISweb sites on your machine.
Web 应用程序项目 Foo 配置为使用IIS。
无法访问IIS 元数据库。您没有足够的权限访问您机器上的IIS网站。
I get this for each of our web applications.
我为我们的每个网络应用程序都得到了这个。
Things I have tried:
我尝试过的事情:
- Running Visual Studio as Administrator
- Running aspnet_regiis.exe -ga MyUserName
- Running aspnet_regiis.exe -i
- 以管理员身份运行 Visual Studio
- 运行 aspnet_regiis.exe -ga MyUserName
- 运行 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?
还有什么我可以尝试做的吗?
采纳答案by jjathman
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.
我通过关闭 Windows 7 中的 IIS 和 .Net Framework 功能然后重新打开它们来解决这个问题。似乎这种重新安装解决了我的问题。我仍然不知道是什么导致了这个问题,但我团队中至少有一位开发人员遇到了同样的问题。
回答by Felipe Ardila
I think you are not running visual studio with administrator permissions. Look that:
我认为您没有以管理员权限运行 Visual Studio。看那个:
http://bloggingabout.net/blogs/rick/archive/2012/10/04/unable-to-access-the-iis-metabase.aspx
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".
解决方案很简单:使用“以管理员身份运行”启动 Visual Studio。您可以通过右键单击快捷方式并选择“以管理员身份运行”来执行此操作。
回答by Jeff B
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 功能......在其中,我们必须选择 Internet 信息服务 -> Web 管理工具 -> IIS 6 管理兼容性 -> IIS 元数据库和 IIS 6 配置兼容性。

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)...
注意:我们使用 Visual Studio 2005 和 2010 在 Windows 7 上运行 IIS 7.5 并使用超级老派的 WebServices (.asmx) 做一些事情......
回答by Francis Rodgers
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.
我正在运行 VS2012,几乎每次我都必须右键单击,以管理员身份运行。我厌倦了这个,所以我在快捷方式上进入了它的属性,单击高级,然后单击“以管理员身份运行”选项。现在,每当我从那个快捷方式打开 VS2012 时,它总是以管理员身份运行。
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 notrun 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.
一旦我像往常一样首先打开VS2012,然后使用文件/打开/项目它再次工作没问题。(因为我以管理员身份运行)。但是当我使用 Windows 文件管理器打开解决方案时,我没有以管理员身份运行。
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.
希望这是有帮助的。
回答by KMX
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.
我今天刚遇到同样的问题。我觉得这很烦人。虽然我已经从同一个 IIS 开发了另外两个网站,但仍然无法创建新网站。奇怪,但我这样做了。
- 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!
- 从 IIS 中删除站点
- 创建新站点,命名为“new_site”
- 选择站点名称以外的应用程序池。所以它不会弄乱默认设置。
- 如果您在同一台机器上运行 IP,请保持“未分配”IP
- 给它一些未使用的端口
- 通过右键单击 VS 可执行快捷方式,以“以管理员身份运行”的身份运行 Visual Studio。
- 你完成了!
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.
如果有人和我一样遇到同样的问题并以同样的方式解决,请告诉我。我认为这不是问题,而是在 Visual Studio 拒绝打开的本地主机上创建网站的错误方式。
I hope this will help newbies.
我希望这会对新手有所帮助。
回答by Mauricio Gracia Gutierrez
- Create a shortcut to the "devenv.exe"
- select the "Run as administrator" option for the shortcut
- doble click on the short cut and reopen your project
- 创建“devenv.exe”的快捷方式
- 为快捷方式选择“以管理员身份运行”选项
- 双击快捷方式并重新打开您的项目
回答by hopkinsrush
I resolved this issue by granting IIS AppPool identity permissions to the %systemroot%\inetsrv\config
我通过授予 IIS AppPool 身份权限解决了这个问题 %systemroot%\inetsrv\config
回答by Gordon Kenyon
On Windows 8 Pro:
在Windows 8 专业版上:
%systemroot%\inetsrv\config
On Windows 7 and 8.1 and 10
在Windows 7、8.1 和 10 上
%systemroot%\System32\inetsrv\config
(Where %systemroot%is usually C:\Windows)
(%systemroot%通常在哪里C:\Windows)
Navigate to the appropriate location above in Windows Explorer. You will be blocked access with a popup which says:
在 Windows 资源管理器中导航到上面的适当位置。您将被一个弹出窗口阻止访问,其中显示:
"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.
单击此文件夹的“继续”,并在下方单击“导出”文件夹。我将快捷方式改回“以我身份运行”(域成员和本地管理员),并且能够打开和部署解决方案。
回答by Nathan Tregillus
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.
我的是应用程序池刚刚关闭。我重新打开它,一切正常。
回答by nologo
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:
如果您正在处理不需要使用 IIS 的项目,那么打开出现此错误的项目的解决方法是只需右键单击卸载的项目并单击编辑,搜索:
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="">
<WebProjectProperties>
<UseIIS>True</UseIIS>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
and set USEIIS to false
并将 USEIIS 设置为 false
<UseIIS>False</UseIIS>
reload the project by right clicking on it after saving changes.
保存更改后通过右键单击重新加载项目。

