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

或者是
下面一段代碼在IIS6.0下運(yùn)轉(zhuǎn)正常,但I(xiàn)IS7.0下運(yùn)轉(zhuǎn)會(huì)出錯(cuò):
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)
二、錯(cuò)誤分析
這段異常代碼表明 IIS://localhost/W3SVC/1 的ADSI provider不存在或者無(wú)法訪問(wèn)。
打開(kāi)IIS管理器你可以看到服務(wù)器的localhost(即默認(rèn)站點(diǎn))是存在的并正在運(yùn)行,且主站點(diǎn)ID確實(shí)是1。這說(shuō)明問(wèn)題是出現(xiàn)在 IIS://localhost的ADSI provider。
三、錯(cuò)誤原因
win7使用的是iis7,而IIS 7默認(rèn)并沒(méi)有安裝ADSI provider。
四、解決方法
要解決這個(gè)問(wèn)題就得安裝“IIS 元數(shù)據(jù)庫(kù)和IIS 6配置兼容性”。
“控制面板”->“程序和功能”->面板左側(cè)“打開(kāi)或關(guān)閉windows功能”->“Internet信息服務(wù)”->“Web管理工具”->“IIS 6管理兼容性”->“IIS 元數(shù)據(jù)庫(kù)和IIS 6配置兼容性”。
如下圖所示:


五、Windows Server 2008出現(xiàn)這種錯(cuò)誤怎么辦?
在Windows Server 2008下,使用角色服務(wù)安裝完“IIS 元數(shù)據(jù)庫(kù)和IIS 6配置兼容性”,還有可能出現(xiàn)如下錯(cuò)誤:
[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)
這是因?yàn)?Windows Server 2008被UAC(User Account Control,用戶賬戶控制)鎖定了. 你需要用管理員(Administrator)賬戶執(zhí)行這個(gè)程序. 另一種方式是設(shè)置運(yùn)行此程序的賬戶擁有如下權(quán)限: Logon as a Service"/ "Logon as a Batch Job"
以上就是解決DirectoryEntry配置IIS7出現(xiàn)ADSI Error錯(cuò)誤的方法,還有引申出來(lái)的Windows Server 2008出現(xiàn)這種錯(cuò)誤的解決辦法,希望對(duì)大家解決這類問(wèn)題有所幫助。
- IIS7.0 運(yùn)行ASP 500錯(cuò)誤 解決方法
- WIN2008系統(tǒng)安裝IIS7配過(guò)ASP后打開(kāi)ASP網(wǎng)站為500錯(cuò)誤的解決辦法
- IIS7.5顯示ASP的詳細(xì)錯(cuò)誤信息"500 – 內(nèi)部服務(wù)器錯(cuò)誤解決"
- IIS7使用.NET Framework v4.0運(yùn)行庫(kù)報(bào)500錯(cuò)誤的解決辦法
- Win7 IIS7.5運(yùn)行ASP時(shí)出現(xiàn)500錯(cuò)誤的解決辦法
- IIS7.5中調(diào)試.Net 4.0網(wǎng)站出現(xiàn)無(wú)厘頭、500錯(cuò)誤的解決方法
- IIS7.5 HTTP 錯(cuò)誤 500 調(diào)用loadlibraryex失敗的解決方法
- IIS7.5 Error Code 0x8007007e HTTP 錯(cuò)誤 500.19的解決方法
- IIS7/iis7.5 HTTP Error 500.19 配置錯(cuò)誤由于權(quán)限不足而無(wú)法讀取配置文件的解決辦法
- IIS7報(bào)500.23錯(cuò)誤的原因分析及解決方法
相關(guān)文章
C# 利用ICSharpCode.SharpZipLib實(shí)現(xiàn)在線壓縮和解壓縮
本文主要主要介紹了利用ICSharpCode.SharpZipLib第三方的DLL庫(kù)實(shí)現(xiàn)在線壓縮和解壓縮的功能,并做了相關(guān)的代碼演示。2016-04-04
使用C#開(kāi)發(fā)OPC?Server服務(wù)器源碼解析
OPC?Server服務(wù)器服務(wù)器的開(kāi)發(fā)比較繁瑣,本示例采用C#提供了一種簡(jiǎn)單快速實(shí)現(xiàn)OPCServer的方法,已經(jīng)在工程項(xiàng)目中應(yīng)用,本文對(duì)C#開(kāi)發(fā)OPC?Server服務(wù)器相關(guān)知識(shí)給大家介紹的非常詳細(xì),需要的朋友參考下吧2022-06-06
Unity實(shí)現(xiàn)輪盤方式的按鈕滾動(dòng)效果
這篇文章主要為大家詳細(xì)介紹了Unity實(shí)現(xiàn)輪盤方式的按鈕滾動(dòng)效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-02-02
使用revit api畫垂直于風(fēng)管的風(fēng)管示例
這篇文章主要介紹了使用revit api畫垂直于風(fēng)管的風(fēng)管示例,需要的朋友可以參考下2014-03-03
c#使用EPPlus將圖片流嵌入到Excel實(shí)現(xiàn)示例
這篇文章主要為大家介紹了c#使用EPPlus將圖片流嵌入到Excel實(shí)現(xiàn)示例,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-12-12
C#實(shí)現(xiàn)在listview中插入圖片實(shí)例代碼
這篇文章主要介紹了C#實(shí)現(xiàn)在listview中插入圖片實(shí)例代碼的相關(guān)資料,需要的朋友可以參考下2017-03-03

