gpt4 book ai didi

c# - System.DirectoryServices.Interop.UnsafeNativeMethods.IAds.GetInfo() 处的 FileNotFoundException

转载 作者:太空狗 更新时间:2023-10-29 17:43:33 28 4
gpt4 key购买 nike

我有这行简单的代码:

var entry = new DirectoryEntry("WinNT://DOMAIN/MachineName, Computer");
Console.WriteLine(entry.Guid);

实际上,路径是由命令行提供的。这个简单的控制台应用程序是为测试而编译的,在我的测试中我发现:

  • 可以连接到我自己的 Windows 7 PC。
  • 可以连接到网络上的任何其他 Windows XP 机器。
  • 连接到网络上的任何其他 Windows 7 机器失败并显示:

Unhandled Exception: System.IO.FileNotFoundException: The network path was not found.

at System.DirectoryServices.Interop.UnsafeNativeMethods.IAds.GetInfo() at System.DirectoryServices.DirectoryEntry.RefreshCache() at System.DirectoryServices.DirectoryEntry.FillCache(String propertyName) at System.DirectoryServices.DirectoryEntry.get_NativeGuid() at System.DirectoryServices.DirectoryEntry.get_Guid() at GetDirectoryEntryProperties.Program.Main(String[] args) in D:\GetDirectoryEntryProperties\Program.cs:line 15

有什么想法吗?

我是所有机器的管理员,但是我确实遇到了另一个由设备锁定服务引起的问题,该服务在询问时导致 UnauthorizedAccessException,但在这种情况下我什至无法阅读 Guid机器。

事件日志没有任何用处。

卢克

最佳答案

我在不同情况下遇到了相同的错误消息。或许我找到的解决方案也能帮到您。

升级到 Windows 10 后,我的电脑在启动时出现弹出错误,看起来就像您发布的错误。它是 System.DirectoryServices.Interop.UnsafeNativeMethods.IAds.GetInfo() 中的 FileNotFoundException。

解决方案是将两个字符串从一个注册表位置复制到另一个位置。

Copy these strings: RegisteredOwner and RegisteredOrganization

From: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion

To: HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion

关于c# - System.DirectoryServices.Interop.UnsafeNativeMethods.IAds.GetInfo() 处的 FileNotFoundException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12113706/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com