如何找出哪个依赖项无法加载

Ant*_*ony 7 .net asp.net

我在尝试运行Web应用程序时收到以下错误:

Exception information: 
    Exception type: ConfigurationErrorsException 
    Exception message: Could not load file or assembly 'Atalasoft.dotImage.AdvancedDocClean.DLL' or one of its dependencies. The specified module could not be found.
Run Code Online (Sandbox Code Playgroud)

我在Windows Server 2003和.NET Framework 4.0上运行.相同的二进制文件和dll在Windows Server 2008 R2服务器上成功运行.

如何找出无法加载的依赖项?

编辑

Fusion日志记录显示以下内容:

*** Assembly Binder Log Entry  (4/11/2011 @ 2:37:42 PM) ***

The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.

Assembly manager loaded from:  C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\WINDOWS\SysWOW64\inetsrv\w3wp.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: User = NT AUTHORITY\NETWORK SERVICE
LOG: DisplayName = Atalasoft.dotImage.AdvancedDocClean
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Atalasoft.dotImage.AdvancedDocClean | Domain ID: 4
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///K:/App/Prd/SEMS/asp/sems/
LOG: Initial PrivatePath = K:\App\Prd\SEMS\asp\sems\bin
LOG: Dynamic Base = C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\sems\cd484e8d
LOG: Cache Base = C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\sems\cd484e8d
LOG: AppName = a29ce80f
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: K:\App\Prd\SEMS\asp\sems\web.config
LOG: Using host configuration file: \\?\C:\WINDOWS\microsoft.net\Framework\v4.0.30319\aspnet.config
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:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/sems/cd484e8d/a29ce80f/Atalasoft.dotImage.AdvancedDocClean.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/sems/cd484e8d/a29ce80f/Atalasoft.dotImage.AdvancedDocClean/Atalasoft.dotImage.AdvancedDocClean.DLL.
LOG: Attempting download of new URL file:///K:/App/Prd/SEMS/asp/sems/bin/Atalasoft.dotImage.AdvancedDocClean.DLL.
LOG: Assembly download was successful. Attempting setup of file: K:\App\Prd\SEMS\asp\sems\bin\Atalasoft.dotImage.AdvancedDocClean.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: Atalasoft.dotImage.AdvancedDocClean, Version=9.0.2.43320, Culture=neutral, PublicKeyToken=2b02b46f7326f73b
LOG: A partially-specified assembly bind succeeded from the application directory. Need to re-apply policy.
LOG: Using application configuration file: K:\App\Prd\SEMS\asp\sems\web.config
LOG: Using host configuration file: \\?\C:\WINDOWS\microsoft.net\Framework\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Atalasoft.dotImage.AdvancedDocClean, Version=9.0.2.43320, Culture=neutral, PublicKeyToken=2b02b46f7326f73b
LOG: GAC Lookup was unsuccessful.
LOG: Binding succeeds. Returns assembly from C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\sems\cd484e8d\a29ce80f\assembly\dl3\63ae24d2\b8096e5c_94f5cb01\Atalasoft.dotImage.AdvancedDocClean.dll.
LOG: Assembly is loaded in default load context.
Run Code Online (Sandbox Code Playgroud)

编辑

无法加载的CppCodeProvider输出

*** Assembly Binder Log Entry  (4/11/2011 @ 2:37:42 PM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\WINDOWS\SysWOW64\inetsrv\w3wp.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: User = NT AUTHORITY\NETWORK SERVICE
LOG: DisplayName = CppCodeProvider, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
 (Fully-specified)
LOG: Appbase = file:///K:/App/Prd/SEMS/asp/sems/
LOG: Initial PrivatePath = K:\App\Prd\SEMS\asp\sems\bin
LOG: Dynamic Base = C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\sems\cd484e8d
LOG: Cache Base = C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\sems\cd484e8d
LOG: AppName = a29ce80f
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: K:\App\Prd\SEMS\asp\sems\web.config
LOG: Using host configuration file: \\?\C:\WINDOWS\microsoft.net\Framework\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: CppCodeProvider, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/sems/cd484e8d/a29ce80f/CppCodeProvider.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/sems/cd484e8d/a29ce80f/CppCodeProvider/CppCodeProvider.DLL.
LOG: Attempting download of new URL file:///K:/App/Prd/SEMS/asp/sems/bin/CppCodeProvider.DLL.
LOG: Attempting download of new URL file:///K:/App/Prd/SEMS/asp/sems/bin/CppCodeProvider/CppCodeProvider.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/sems/cd484e8d/a29ce80f/CppCodeProvider.EXE.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/sems/cd484e8d/a29ce80f/CppCodeProvider/CppCodeProvider.EXE.
LOG: Attempting download of new URL file:///K:/App/Prd/SEMS/asp/sems/bin/CppCodeProvider.EXE.
LOG: Attempting download of new URL file:///K:/App/Prd/SEMS/asp/sems/bin/CppCodeProvider/CppCodeProvider.EXE.
LOG: All probing URLs attempted and failed.
Run Code Online (Sandbox Code Playgroud)

And*_*ite 5

好吧,似乎缺少的依赖是Atalasoft.dotImage.AdvancedDocClean.DLL.当你在2008机器上运行它时,你知道这个DLL的加载位置吗?您是将它本地部署在Web应用程序的bin目录中,还是安装在该计算机上的某个位置,或者安装在GAC中?

要验证的另一件事是您在两台计算机上运行相同版本的.NET.如果2008计算机运行的是.NET 4,而2003计算机没有运行,则可能无法加载相同的DLL.

Fusion是调试装配加载问题的有用工具.Fusion记录随.NET一起提供,您只需启用它,并使用Fusion Log Viewer:

http://msdn.microsoft.com/en-us/library/e74a18c4(VS.71).aspx

  • 在发现CppCodeProvider失败后,我安装了Visual C++ 2010 Redistributable,问题解决了. (2认同)