DirectorySearcher从工作不为Windows 7 64位或32位通过网络不为、工作、网络、DirectorySearcher

2023-09-06 19:13:14 作者:温瞳 Sou1ゝ

我有一个驻留在网络驱动器上的应用程序。

I have an application that resides on a network drive.

在程序从XP的机器上运行桌面上或网络上的程序适用于任何用户。当它从Win 7的运行在桌面上它适用于每个人,但是当它从Win 7的在网络上运行失败,为用户提供较少的权限。下面是code。它未能在最后一行昏暗的信息搜索结果作为信息搜索结果= directorySearcher.FindOne

When the program runs from an XP machine on the desktop or over the network the program works for any user. When it runs from Win 7 on the desktop it works for everyone, but when it runs from Win 7 over the network it fails for users with fewer permissions. Below is the code. It fails on the last line "Dim searchResult As SearchResult = directorySearcher.FindOne"

Dim adpath As String = "LDAP://OU=orgOU,DC=ad,DC=orgDC,DC=edu"
Dim directoryEntry As New DirectoryEntry(adpath)
directoryEntry.AuthenticationType = AuthenticationTypes.Secure
Dim directorySearcher As New DirectorySearcher(directoryEntry)
directorySearcher.Filter = getFilter(samAccountName)
directorySearcher.SearchScope = SearchScope.Subtree
Dim searchResult As SearchResult = directorySearcher.FindOne

谁能告诉我什么是在网络的权限丢失?

Can anyone tell me what is missing in the network permissions?

推荐答案

您似乎使用服务器绑定,可以尝试设置:

You appear to be using serverless binding, try setting:

AuthenticationType = AuthenticationTypes.Secure | AuthenticationTypes.ReadonlyServer

这是在MSDN文档 AuthenticationTypes.ReadOnlyServer

有关Active Directory域服务,这个标志表示不需要一个服务器绑定可写的服务器。

For Active Directory Domain Services, this flag indicates that a writable server is not required for a serverless binding.

你也应该pferably与使用语句处理您的可支配的对象,$ P $。是这样的:

Also you should be disposing your disposable objects, preferably with the Using statement. Something like:

Using directoryEntry = New DirectoryEntry...

Using directorySearcher = new DirectorySearcher(...