Windows Server 2008 中的目录服务
我们有一些较旧的代码,我们将在将来升级,但现在我们想弄清楚为什么此代码对于 2008 年的所有域都无效。
我们的旧代码:
entry = new DirectoryEntry("WinNT://" + domain + "/" + username);
新代码:
UserPrincipal u= UserPrincipal.FindByIdentity(c,
IdentityType.SamAccountName, username)
我们有 2尽管我们不控制这些域,但彼此信任。在 Server 2003 中,旧代码在两个域中都可以正常工作。在 Server 2008 中,它为我们的主域成功返回数据,但为另一个域抛出异常。
错误是:
System.Runtime.InteropServices.COMException (0x80070035): The network path was not found.
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObject()
at System.DirectoryServices.PropertyValueCollection.PopulateList()
at System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName)
at System.DirectoryServices.PropertyCollection.get_Item(String propertyName)
为什么 WinNT 在 2003 年可以正常工作,但在 2008 年却对一个域失败? Microsoft 有关于 WinNT 类型的 DirectoryEntry 的任何文档吗?除了升级代码之外,在 Server 2008 中还有其他方法可以解决此问题吗?
We have some older code that we'll be upgrading in the future, but for now we'd like to figure out why this code is not valid for all of our domains in 2008.
Our older code:
entry = new DirectoryEntry("WinNT://" + domain + "/" + username);
The newer code:
UserPrincipal u= UserPrincipal.FindByIdentity(c,
IdentityType.SamAccountName, username)
We have 2 domains, one trusts the other, though we don't control the domains. In Server 2003 the older code works without any problems for both domains. In Server 2008 it returns data successfully for our main domain, but throws an exception for the other.
The error is:
System.Runtime.InteropServices.COMException (0x80070035): The network path was not found.
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObject()
at System.DirectoryServices.PropertyValueCollection.PopulateList()
at System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName)
at System.DirectoryServices.PropertyCollection.get_Item(String propertyName)
Why does WinNT fail for one domain in 2008, when it worked in 2003? Does Microsoft have any documentation on the WinNT type of DirectoryEntry? Is there a way to resolve this in Server 2008, other than upgrading the code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论