FileNotFoundException异常在System.DirectoryServices.Interop.UnsafeNativeMethods.IAds.GetInfo() [英] FileNotFoundException at System.DirectoryServices.Interop.UnsafeNativeMethods.IAds.GetInfo()
问题描述
我的代码,这个简单的行:
进入VAR =新的DirectoryEntry(WINNT:// DOMAIN /计算机名,电脑);
Console.WriteLine(entry.Guid);
在现实中,该路径是通过命令行供给。这个简单的控制台应用程序编译测试,在我的测试中,我发现:
- 连接到我自己的Windows 7 PC的作品
- 连接到任何其他的Windows XP机器在网络上,作品
- 连接到网络上的任何其他Windows 7计算机失败:
未处理的异常信息:System.IO.FileNotFoundException:网络路径找不到
在System.DirectoryServices.Interop.UnsafeNativeMethods.IAds.GetInfo()
在System.DirectoryServices.DirectoryEntry.RefreshCache()
在System.DirectoryServices.DirectoryEntry.FillCache(字符串propertyName的)
在System.DirectoryServices.DirectoryEntry.get_NativeGuid()
在System.DirectoryServices.DirectoryEntry.get_Guid()
在GetDirectoryEntryProperties.Program.Main(字串[] args)在D:\GetDirectoryEntryProperties \Program.cs:第15行
块引用>
任何想法
我我对所有机器的管理员,但我确实有致造成一个
UnauthorizedAccessException
在审讯一个设备锁定服务另外一个问题,但在这种情况下,我甚至不能读GUID的机器。
事件日志中显示没有用的。
路
解决方案
我碰到了同样的错误消息传来了不同的情况
升级到Windows 10后,开机,看起来就像你贴一个当我的电脑给了一个弹出错误。这是在System.DirectoryServices.Interop.UnsafeNativeMethods.IAds.GetInfo()出现FileNotFoundException。
解决的办法是两个字符串从一个注册表位置复制到另一个。
复制这些字符串:RegisteredOwner和RegisteredOrganization
从:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT \CurrentVersion
要:HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion
I have this simple line of code:
var entry = new DirectoryEntry("WinNT://DOMAIN/MachineName, Computer");
Console.WriteLine(entry.Guid);
In reality, the path is supplied by command line. This simple Console App is compiled for testing and in my tests I find that:
- Connecting to my own Windows 7 PC works.
- Connecting to any other Windows XP machine on the network, works.
- Connecting to any other Windows 7 machines on the network fails with:
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
Any ideas?
I am an administrator on all machines, however I did have another issue caused by a Device Lock service which caused an UnauthorizedAccessException
on interrogation, but in this case I can't even read the Guid of the machine.
Event Log is showing nothing of use.
Luke
I came across the same error message for a different situation. Perhaps the solution I found could help you too.
After upgrading to Windows 10, my computer gave a popup error when booting up that looked just like the one you posted. It was a FileNotFoundException at System.DirectoryServices.Interop.UnsafeNativeMethods.IAds.GetInfo().
The solution was to copy two strings from one registry location to another.
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
这篇关于FileNotFoundException异常在System.DirectoryServices.Interop.UnsafeNativeMethods.IAds.GetInfo()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!