DirectoryEntry配置IIS7出现ADSI Error:未知错误(0x80005000)
Posted on 2017-06-23 16:57 WebEnh 阅读(450) 评论(0) 编辑 收藏 举报一、错误情况
环境:win7+iis7.0
DirectoryEntry配置IIS7出现如下错误
或者是
下面一段代码在IIS6.0下运转正常,但IIS7.0下运转会出错:
System.DirectoryServices.DirectoryEntry iisServer;
iisServer = new System.DirectoryServices.DirectoryEntry("IIS://localhost/W3SVC/1");
System.DirectoryServices.DirectoryEntry rootFolder = iisServer.Children.Find("Root","IIsWebVirtualDir");//此处抛出异常
异常内容如下:
[System.Runtime.InteropServices.COMException] {"Unknown error (0x80005000)"}
System.Runtime.InteropServices.COMException
Unknown error (0x80005000)
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_IsContainer()
at System.DirectoryServices.DirectoryEntries.CheckIsContainer()
at System.DirectoryServices.DirectoryEntries.Find(String name, String schemaClassName)
二、错误分析
这段异常代码表明 IIS://localhost/W3SVC/1 的ADSI provider不存在或者无法访问。
打开IIS管理器你可以看到服务器的localhost(即默认站点)是存在的并正在运行,且主站点ID确实是1。这说明问题是出现在 IIS://localhost的ADSI provider。
三、错误原因
win7使用的是iis7,而IIS 7默认并没有安装ADSI provider。
四、解决方法
要解决这个问题就得安装“IIS 元数据库和IIS 6配置兼容性”。
“控制面板”->“程序和功能”->面板左侧“打开或关闭windows功能”->“Internet信息服务”->“Web管理工具”->“IIS 6管理兼容性”->“IIS 元数据库和IIS 6配置兼容性”。
如下图所示:
五、更好的解决方法
更理想的解决方式是用 WMI provider操作IIS 7 ,可参见此篇文章http://msdn.microsoft.com/en-us/library/aa347459.aspx
六、Windows Server 2008出现这种错误怎么办?
在Windows Server 2008下,使用角色服务安装完“IIS 元数据库和IIS 6配置兼容性”,还有可能出现如下错误:
[System.Runtime.InteropServices.COMException] {"Access is denied.\r\n"} System.Runtime.InteropServices.COMException
ErrorCode 0x80070005
Access is denied.
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_IsContainer()
at System.DirectoryServices.DirectoryEntries.CheckIsContainer()
at System.DirectoryServices.DirectoryEntries.Find(String name, String schemaClassName)
这是因为 Windows Server 2008被UAC(User Account Control,用户账户控制)锁定了. 你需要用管理员(Administrator)账户执行这个程序. 另一种方式是设置运行此程序的账户拥有如下权限: Logon as a Service"/ "Logon as a Batch Job"
本博客Android APP 下载 |
![]() |
支持我们就给我们点打赏 |
![]() |
支付宝打赏 支付宝扫一扫二维码 |
![]() |
微信打赏 微信扫一扫二维码 |
![]() |
如果想下次快速找到我,记得点下面的关注哦!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!