加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – FileNotFoundException在System.DirectoryServices.Intero

发布时间:2020-12-15 04:14:17 所属栏目:百科 来源:网络整理
导读:我有这个简单的代码行: var entry = new DirectoryEntry("WinNT://DOMAIN/MachineName,Computer");Console.WriteLine(entry.Guid); 实际上,路径由命令行提供.这个简单的控制台应用程序是为了测试而编译的,在我的测试中我发现: 连接到我自己的Windows 7 PC
我有这个简单的代码行:
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:GetDirectoryEntryPropertiesProgram.cs:line 15

有任何想法吗?

我是所有机器上的管理员,但是由于设备锁定服务引起了另一个问题,导致在询问时出现UnauthorizedAccessException异常,但在这种情况下,我甚至无法阅读机器的Guid.

事件日志没有任何用处.

卢克

解决方法

对于不同的情况,我遇到了同样的错误信息.也许我发现的解决方案也可以帮助你.

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

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

Copy these strings: RegisteredOwner and RegisteredOrganization

From: HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersion

To: HKEY_LOCAL_MACHINESOFTWAREWOW6432NodeMicrosoftWindows NTCurrentVersion

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读