DirectoryEntry配置IIS7出現(xiàn)ADSI Error:未知錯誤(0x80005000)
一、錯誤情況
環(huán)境:win7+iis7.0
DirectoryEntry配置IIS7出現(xiàn)如下錯誤

或者是
下面一段代碼在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");//此處拋出異常
異常內(nèi)容如下:
[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。這說明問題是出現(xiàn)在 IIS://localhost的ADSI provider。
三、錯誤原因
win7使用的是iis7,而IIS 7默認并沒有安裝ADSI provider。
四、解決方法
要解決這個問題就得安裝“IIS 元數(shù)據(jù)庫和IIS 6配置兼容性”。
“控制面板”->“程序和功能”->面板左側“打開或關閉windows功能”->“Internet信息服務”->“Web管理工具”->“IIS 6管理兼容性”->“IIS 元數(shù)據(jù)庫和IIS 6配置兼容性”。
如下圖所示:


五、Windows Server 2008出現(xiàn)這種錯誤怎么辦?
在Windows Server 2008下,使用角色服務安裝完“IIS 元數(shù)據(jù)庫和IIS 6配置兼容性”,還有可能出現(xiàn)如下錯誤:
[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)賬戶執(zhí)行這個程序. 另一種方式是設置運行此程序的賬戶擁有如下權限: Logon as a Service"/ "Logon as a Batch Job"
以上就是解決DirectoryEntry配置IIS7出現(xiàn)ADSI Error錯誤的方法,還有引申出來的Windows Server 2008出現(xiàn)這種錯誤的解決辦法,希望對大家解決這類問題有所幫助。
- IIS7.0 運行ASP 500錯誤 解決方法
- WIN2008系統(tǒng)安裝IIS7配過ASP后打開ASP網(wǎng)站為500錯誤的解決辦法
- IIS7.5顯示ASP的詳細錯誤信息"500 – 內(nèi)部服務器錯誤解決"
- IIS7使用.NET Framework v4.0運行庫報500錯誤的解決辦法
- Win7 IIS7.5運行ASP時出現(xiàn)500錯誤的解決辦法
- IIS7.5中調(diào)試.Net 4.0網(wǎng)站出現(xiàn)無厘頭、500錯誤的解決方法
- IIS7.5 HTTP 錯誤 500 調(diào)用loadlibraryex失敗的解決方法
- IIS7.5 Error Code 0x8007007e HTTP 錯誤 500.19的解決方法
- IIS7/iis7.5 HTTP Error 500.19 配置錯誤由于權限不足而無法讀取配置文件的解決辦法
- IIS7報500.23錯誤的原因分析及解決方法
相關文章
C# 利用ICSharpCode.SharpZipLib實現(xiàn)在線壓縮和解壓縮
本文主要主要介紹了利用ICSharpCode.SharpZipLib第三方的DLL庫實現(xiàn)在線壓縮和解壓縮的功能,并做了相關的代碼演示。2016-04-04
c#使用EPPlus將圖片流嵌入到Excel實現(xiàn)示例
這篇文章主要為大家介紹了c#使用EPPlus將圖片流嵌入到Excel實現(xiàn)示例,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-12-12

