System.IO.FileNotFoundException在调用DirectoryEntry()后发生
我正在调试一个我刚刚写的小型C#应用程序。该应用程序似乎运行在我的开发很好,但是当在其他机器上运行引发以下错误(所有的机器都是窗W/.NET 4安装7专业版64位):System.IO.FileNotFoundException在调用DirectoryEntry()后发生
Application: WolApp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException
Stack:
at WolApp.PowerModel..ctor()
at WolApp.PowerController..ctor()
at WolApp.Program.Main()
第二个错误成功这从一个kernelbase.dll,但是,一件事一时间....
从堆栈跟踪似乎未处理的异常正在被肆意的PowerModel构造函数,它仅由这里面:
public PowerModel() {
entry = new DirectoryEntry();
}
入口是PowerModel类的字段。我已经添加了下面的try catch块
public PowerModel() {
try
{
entry = new DirectoryEntry();
}
catch (System.IO.FileNotFoundException e)
{
string sSource;
string sLog;
string sEvent;
sSource = "WolApp";
sLog = "Application";
sEvent = e.Message;
EventLog.CreateEventSource(sSource,sLog);
EventLog.WriteEntry(sSource, sEvent);
}
}
但仍然抛出同样的异常(并且只在外部机器上)?
另外,出现另一个消息日志从Windows错误报告中,具体如下:
1745074215
5
CLR20r3
Not available
0
wolapp.exe
1.0.0.0
4d657be0
WolApp
1.0.0.0
4d657be0
3
26
System.IO.FileNotFoundException
C:\Users\username\AppData\Local\Temp\WERC3EF.tmp.WERInternalMetadata.xml
C:\Users\username\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_wolapp.exe_62bdee217c82fa90fcdaeb137c1659c897785b85_20036868
0
ce7dc05c-3f93-11e0-8907-0024e82e58f8
0
DirectoryEntry
从System.DirectoryServices
命名空间和涉及在Active Directory条目的类。
它毫无关系,在磁盘上的目录中的条目......我最惊讶的,你会得到与这个FileNotFoundExeption
......
(不适用)
或者,如果它的
不是你正在谈论的
System.DirectoryServices.DirectoryEntry
,那么这是一个
极其这个类的类名称的错误选择!
我还没有看到这个问题,但类似的东西出现here on MSDN,具有修复。
编辑我只是重新读一遍你的错误消息,并且该位跳了出来:
CLR20r3
Not available
不要在其他机器已经NET 2.0安装? FileNotFoundException
听起来像是找不到CLR。
This link描述了与您的问题类似的另一个问题(具有分辨率)。
谢谢!有趣的链接.... – 2011-02-23 21:47:33
当我发现那篇文章时,我很兴奋,但我不相信它适用。具体而言,他们收到的错误是 System.IO.FileNotFoundException:未找到网络路径。 (来自HRESULT的异常:0x80070035) 虽然在我的应用程序中收到的错误似乎没有任何指定信息。 – dilzniksan 2011-02-23 21:56:05
所有机器都运行.NET 4.0.30319。 我不愿意认为第二个问题也适用; DirectoryEntry()似乎在提供任何凭证(即它试图连接到任何DC之前)之前会生成一个错误。 – dilzniksan 2011-02-23 22:22:09
也许这不是很相关,但我面对同样的问题,错误信息是完全不确定的。下面是我收到
- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
<Provider Name=".NET Runtime" />
<EventID Qualifiers="0">1026</EventID>
<Level>2</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2014-03-16T08:38:12.000000000Z" />
<EventRecordID>8249</EventRecordID>
<Channel>Application</Channel>
<Computer>ADCOWDPTEST1</Computer>
<Security />
</System>
- <EventData>
<Data>Application: Well Abandonment Automation.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.IO.FileNotFoundException Stack: at WA.Client.RequestList.InitializeComponent() at WA.Client.RequestList..ctor() at WA.Client.Program.Main()</Data>
</EventData>
</Event>
有点周围挖后的错误,我发现我引用这是安装在我的开发机器上,并在服务器上没有安装第三方的DLL。
我的想法确切。我正在尝试使用System.DirectoryServices。 – dilzniksan 2011-02-23 21:57:42
@dilzniksan:我想知道的是你要创建一个DirectoryEntry对象实例,而不指定该对象的LDAP路径... – 2011-02-23 21:59:17
我自己使用DirectoryEntry,我遇到来自互操作边界调用的FNF异常。但是...直通评论最显着 - 甚至是关于DirectoryServices名称空间的问题? – 2012-08-24 12:28:25