DirectorySearcher从工作不为Windows 7 64位或32位通过网络 [英] DirectorySearcher not working for Windows 7 64 bit or 32 bit over network

查看:154
本文介绍了DirectorySearcher从工作不为Windows 7 64位或32位通过网络的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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(...

这篇关于DirectorySearcher从工作不为Windows 7 64位或32位通过网络的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆