DirectoryEntryオブジェクトを使用してリモートWindows7マシンに接続しようとしています。これが私のコードです
DirectoryEntry obDirEntry = new DirectoryEntry("WinNT://hostName", "hostName\\testUser", "password123", AuthenticationTypes.Secure);
try
{
if (obDirEntry.Properties.Count > 0)
{
//ok
}
}
catch (Exception excp)
{}
リモートWindowsServer2003マシンまたはローカルWindows7マシンに接続できる場合、エラーは発生しませんでした。しかし、リモートのWindows 7マシンに接続しようとすると、行で例外が発生しますif (obDirEntry.Properties.Count > 0)
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.PropertyCollection.get_Count()
そのリモートウィンドウに7m/cでpingを実行できます。ファイアウォールとUACもオフになっています。問題は、各リモートWindows7マシンでこの問題が発生していることです。ホスト名ではなくURLにIPアドレスを入れようとしましたが、その場合、ローカルマシンでも例外を超えます。nslookupコマンドは、そのリモートm /chostNameを解決できます。これの理由は何でしょうか?これに対して可能な解決策は何ですか?前もって感謝します !!