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

时间:2011-04-11 04:11:38

标签: .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.

我在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.

修改

无法加载的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.

4 个答案:

答案 0 :(得分: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

答案 1 :(得分:2)

我看到很多参考 http://msdn.microsoft.com/en-us/library/e74a18c4(VS.71).aspx

但请记住,这是.NET 1.1版本,它有ASP.NET单选按钮。在新的融合日志中,您没有ASP.NET单选按钮。

我还没有看到有关如何使用Fusion Log with ASP.NET的文档。注册表项更改是我随处可见的选项,但是有没有适用于4.0版的文档吗?

有人知道吗?


更新:我在这里找到了解决方案。我猜,我崩溃了,开始在注册表上工作。

HKEY_LOCAL_MACHINE \ SOFTWARE \微软\融合

添加:

DWORD ForceLog将值设置为1
DWORD LogFailures将值设置为1

DWORD LogResourceBinds将值设置为1

String LogPath将值设置为日志文件夹即)C:\ FusionLog \

答案 2 :(得分:0)

我建议在这里查看Fusion日志的文档

不幸的是,错误可能表示您尝试加载的DLL的依赖项存在问题,如果启用了日志记录,您应该能够确切地看到这是哪一个。请注意,加载到加载应用程序中的依赖项不足以在所有情况下对它进行dll访问(如果它们不共享相同的应用程序域)。我在尝试使用自己的应用程序域制作插件时遇到了一些问题

答案 3 :(得分:-1)

我认为这意味着它的DLL不在应用程序的bin文件夹中。尝试抓取程序集的DLL并手动将其放入该文件夹中。