我有一个简单的控制台应用程序,它使用第三方dll(32位)(它依赖于另外两个dll,复制到同一路径)和dotnet framework 4.5。此应用程序适用于本地Windows 7机器。但是,当在Windows服务器2012 R2中运行时,同样的情况会崩溃并显示以下消息。
System.IO.FileNotFoundException: Could not load file or assembly 'dcasdk.dll' or one of its dependencies. The specified module could not be found.
File name: 'dcasdk.dll'
来自事件查看器:
Faulting application name: ConsoleApplication2.exe, version: 1.0.0.0, time stamp: 0x590c51de
Faulting module name: KERNELBASE.dll, version: 6.3.9600.18340, time stamp: 0x5736541b
Exception code: 0xe0434352
Fault offset: 0x00014878
Faulting process id: 0x9a4
Faulting application start time: 0x01d2c5898c929ee7
Faulting application path: C:\Debug\ConsoleApplication2.exe
Faulting module path: C:\Windows\SYSTEM32\KERNELBASE.dll
Report Id: ca4bbc88-317c-11e7-818e-0ac916d6c5ab
Faulting package full name:
Faulting package-relative application ID:
错误消息日志记录后面的消息,尽管所有三个dll都在同一个地方。
System.IO.FileNotFoundException: Could not load file or assembly 'dcasdk.dll' or one of its dependencies. The specified module could not be found.
File name: 'dcasdk.dll'
我尝试用x86编译应用程序,这有助于帮助。
有关如何找到根本原因\使dcasdk dll加载失败的原因的任何帮助都会有所帮助。
Fusion日志
Fusion日志表示加载成功。尽管应用程序崩溃,但融合日志中没有任何错误与任何其他dll相关。
=== Pre-bind state information ===
LOG: DisplayName = dcasdk, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = ConsoleApplication2.exe
Calling assembly : ConsoleApplication2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Debug\ConsoleApplication2.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Debug/dcasdk.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Debug\dcasdk.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: dcasdk, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null
LOG: Binding succeeds. Returns assembly from C:\Debug\dcasdk.dll.
LOG: Assembly is loaded in default load context.
Dependency walker将这些dll显示为缺失。
API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
DCOMP.DLL
IESHIMS.DLL
答案 0 :(得分:1)
安装 MIcrosoft Visual C ++可再发行组件包(x86)解决了此问题。 依赖步行者有误导性。我能够使用 Process Monitor 工具找到根本原因。
感谢。
答案 1 :(得分:0)
我没有足够的回复发表评论,但这可能是BadImageFormatException Could not load file or assembly or one of its dependencies. An attempt was made to load a program with an incorrect format的重复
在仅定位 <div id="container_chart" class="container_chart" style="min-width: 310px; height: 400px;"></div>
<table id="datatable">
<thead>
<tr>
<th></th>
<th>Distribution</th>
<th>Return</th>
</tr>
</thead>
<tbody>
<tr>
<th>2011</th>
<td>6250</td>
<td>6250</td>
</tr>
<tr>
<th>2012</th>
<td>28205</td>
<td>40000</td>
</tr>
<tr>
<th>2013</th>
<td>26000</td>
<td>34750</td>
</tr>
<tr>
<th>2014</th>
<td>32500</td>
<td>10000</td>
</tr>
</tbody>
</table>
之前,您的平台是否定位AnyCPU
?此外,x86
您确定它还定位到dcasdk.dll
并且没有定位到特定平台吗?