首頁  >  文章  >  php教程  >  DirectoryEntry設定IIS7出現ADSI Error:未知錯誤(0x80005000)

DirectoryEntry設定IIS7出現ADSI Error:未知錯誤(0x80005000)

高洛峰
高洛峰原創
2017-01-06 16:17:111594瀏覽

一、錯誤情況

環境:win7+iis7.0

DirectoryEntry配置IIS7出現如下錯誤

DirectoryEntry配置IIS7出现ADSI Error:未知错误(0x80005000)

或是

下面代碼在IIS6.0下代碼在IIS6. :

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. 0x80005000)
   at System. DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
   at System.DirectoryServices.DirectoryEntry.Bind()
   at System.DirectoryServices.DirectoryEntry.get_IsContainer()🠟,約.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配置相容性」。

如下圖:

DirectoryEntry配置IIS7出现ADSI Error:未知错误(0x80005000)

 五、Windows Server 2008出現這種錯誤怎麼辦?

DirectoryEntry配置IIS7出现ADSI Error:未知错误(0x80005000)在Windows Server 2008下,使用角色服務安裝完“IIS 元資料庫和IIS 6配置相容性”,還有可能出現以下錯誤: 

[System.Runtime.InteropServices.COMException] {"Access is denied.rn "} System.Runtime.InteropServices.COMException

ErrorCode 0x80070005

Access is denied.

   at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfail)🠎p.  at System.DirectoryServices.DirectoryEntry. get_IsContainer()
   at System.DirectoryServices.DirectoryEntries.CheckIsContainer()
   at System.DirectoryServices.DirectoryEntries.Find(String name, String schemaClassName)

這是因為使用者 Windows了.  你需要用管理員(Administrator)帳戶執行這個程式. 另一種方式是設定執行此程式的帳戶擁有以下權限: Logon as a Service"/ "Logon as a Batch Job"

 以上就是解決DirectoryEntry配置IIS7出現ADSI Error錯誤的方法,還有引申出來的Windows Server 2008出現這種錯誤的解決辦法,希望對大家解決這類問題有所幫助。 )相關文章請關注PHP中文網!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn