关于C#中控制IIS的问题(DirectorySearcher)

DirectoryEntry root = new DirectoryEntry ("IIS://localhost/w3svc","administrator","2040601",AuthenticationTypes.Secure &    AuthenticationTypes.ServerBind);
    DirectorySearcher searcher = new DirectorySearcher(root);

程序跳框说提供程序不支持搜索操作,因此无法搜索IIS://localhost/w3svc

System.DirectoryServices 命名空間 (Namespace) 提供從 Managed 程式碼對 Active Directory 的簡易存取。命名空間包含兩個元件類別: DirectoryEntry 和 DirectorySearcher ,它們使用 Active Directory Services Interface (ADSI) 技術。ADSI 是一組 Microsoft 提供的介面,做為與多種網路提供者一起使用的彈性工具。不管網路的大小為何,ADSI 能夠減輕系統管理員尋找並管理網路資源的負擔。

這個命名空間中的類別可以搭配任何 Active Directory 服務提供者使用。目前的提供者有 Internet Information Services (IIS)、Lightweight Directory Access Protocol (LDAP)、Novell NetWare Directory Service (NDS) 和 WinNT。

ADSI 是 Microsoft Active Directory 的程式設計介面,使用單一介面就可以讓您的應用程式與網路上多種目錄進行互動。使用 ADSI,您可以建立可執行一般工作的應用程式,例如備份資料庫、存取印表機、和管理使用者帳戶。

它假設您在使用這些類別之前已對 Active Directory 有一般性瞭解。如需 Active Directory 的詳細資訊,請參閱 Active Directory 物件簡介 、 Active Directory 技術背景 和 MSDN Library (msdn.microsoft.com) 中的 Active Directory 主題:

Active Directory Programmers Guide
Active Directory Service Interfaces
Lightweight Directory Access Protocol API
ADSI System Providers
WinNT Binding String
Binding
IADsOpenDSObject::OpenDSObject
Active Directory 是樹狀結構。樹狀結構中的每一個節點都包含一組屬性。使用這個命名空間來往返、搜尋和修改樹狀結構,以及讀取與寫入節點的屬性。

DirectoryEntry 類別會將 Active Directory 階層架構中的節點或物件封裝。使用這個類別以繫結至物件、讀取屬性 (Property) 和更新屬性 (Attribute)。協同 Helper 類別, DirectoryEntry 提供存留週期管理與巡覽方法的支援,包括建立、刪除、重新命名、移除子節點和列舉子系等。

使用 DirectorySearcher 類別來執行對 Active Directory 階層架構的查詢。LDAP 是唯一提供 Active Directory Service Interfaces (ADSI) 提供者 (支援搜尋) 的系統。

透過 DirectorySearcher 搜尋 Active Directory 階層架構可傳回 SearchResult 的執行個體 (Instance),其包含在 SearchResultCollection 類別的執行個體中。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值