DotNet 控制台应用程序崩溃,并显示消息"FileNotFoundException"。虽然 dll 存在并正在加载



i具有一个简单的控制台应用程序,该应用程序使用第三方DLL(32位((取决于两个DLL,复制到同一路径(和dotnet Framework 4.5。该应用程序在本地Windows 7机器中起作用。但是,在Windows Server 2012中运行时也是如此,并带有以下消息。

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:DebugConsoleApplication2.exe
Faulting module path: C:WindowsSYSTEM32KERNELBASE.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 Log中没有任何其他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:DebugConsoleApplication2.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:WindowsMicrosoft.NETFrameworkv4.0.30319configmachine.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:Debugdcasdk.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:Debugdcasdk.dll.
LOG: Assembly is loaded in default load context.

依赖关系沃克将这些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

安装 Microsoft Visual C 重新分布软件包(X86(解决了此问题。依赖性沃克(Walker(具有误导性。我能够使用 Process Monitor 工具来解决根本原因。

谢谢。

我没有足够的代表来发表评论,但这可能是BadImageFormateXception的重复,无法加载文件或汇编或其依赖项之一。试图加载具有不正确格式的程序

您的平台目标AnyCPU是否仅针对x86?另外,dcasdk.dll您确定它也针对AnyCPU并且不是针对特定平台的?

相关内容

  • 没有找到相关文章

最新更新