如何找出哪个依赖未能加载加载

2023-09-03 02:02:54 作者:一次就好我陪你看天荒地老

我正在尝试运行Web应用程序时出现以下错误:

 异常信息:
    异常类型:ConfigurationErrorsException
    异常消息:无法加载文件或程序集Atalasoft.dotImage.AdvancedDocClean.DLL或它的某一个依赖。指定的模块无法找到。
 

我的Windows Server 2003和放大器上运行; .NET框架4.0。同样的二进制文件和dll的成功在Windows Server 2008 R2的服务器上运行。

我如何能找出相关的加载失败?

修改

融合记录显示以下内容:

  ***大会粘结剂日志条目(4/11/2011 @下午2时37分42秒)***

手术很成功。
绑定结果:HR =为0x0。操作已成功完成。

C:从装配​​经理装\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \ clr.dll
下可执行的C运行:\ WINDOWS \ Syswow64资料\ INETSRV \程序w3wp.exe
---详细的错误日志如下。

=== pre-绑定状态信息===
日志:用户= NT AUTHORITY \ NETWORK SERVICE
日志:显示名称= Atalasoft.dotImage.AdvancedDocClean
 (部分)
警告:部分绑定信息是提供程序集:
警告:程序集名称:Atalasoft.dotImage.AdvancedDocClean |域ID:4
警告:程序集显示名称的一部分提供时,会出现局部绑定。
警告:这可能导致粘合剂加载了不正确的装配。
警告:建议提供了一个完全指定的文字标识的组装,
警告:即由简单的名称,版本,区域性和公钥令牌。
警告:请参阅白皮书http://go.microsoft.com/fwlink/?LinkId=109270了解更多信息,共同解决这一问题。
日志:应用平台=文件:/// K:/应用/ PRD / SEMS / ASP / SEMS /
LOG:初始PrivatePath = K:\ APP \珠三角\ SEMS \ ASP \ SEMS \ BIN
日志:动基座= C:\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \临时ASP.NET文件\ SEMS \ cd484e8d
日志:缓存基地= C:\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \临时ASP.NET文件\ SEMS \ cd484e8d
LOG:AppName的= a29ce80f
调用汇编:(未知)。
===
日志:此绑定从default加载上下文。
日志:正在使用应用程序配置文件:K:\ APP \珠三角\ SEMS \ ASP \ SEMS \ web.config中
日志:使用主机配置文件:\\ \ C:\ WINDOWS \ microsoft.net \框架\ v4.0.30319 \ aspnet.config
日志:从C使用计算机配置文件:\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \ CONFIG \ machine.config中。
日志:政策不被应用到引用在这个时候(私人,自定义,局部的,或基于位置的程序集绑定)。
日志:新的URL文件试图下载:/// C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET文件/ SEMS / cd484e8d / a29ce80f / Atalasoft.dotImage.AdvancedDocClean.DLL。
日志:尝试新的URL文件下载:/// C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/sems/cd484e8d/a29ce80f/Atalasoft.dotImage.AdvancedDocClean/Atalasoft.dotImage.AdvancedDocClean.DLL.
日志:新的URL文件试图下载:/// K:/App/Prd/SEMS/asp/sems/bin/Atalasoft.dotImage.AdvancedDocClean.DLL。
日志:程序集下载成功。文件试图设置:K:\ APP \珠三角\ SEMS \ ASP \ SEMS \ BIN \ Atalasoft.dotImage.AdvancedDocClean.dll
日志:进入下载缓存安装阶段。
日志:大会名称为:Atalasoft.dotImage.AdvancedDocClean,版本= 9.0.2.43320,文化=中性公钥= 2b02b46f7326f73b
日志:从应用程序目录中的部分指定的程序集绑定成功。需要重新申请的政策。
日志:正在使用应用程序配置文件:K:\ APP \珠三角\ SEMS \ ASP \ SEMS \ web.config中
日志:使用主机配置文件:\\ \ C:\ WINDOWS \ microsoft.net \框架\ v4.0.30319 \ aspnet.config
日志:从C使用计算机配置文件:\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \ CONFIG \ machine.config中。
日志:后政策参考:Atalasoft.dotImage.AdvancedDocClean,版本= 9.0.2.43320,文化=中性公钥= 2b02b46f7326f73b
日志:GAC查找不成功。
日志:绑定成功。返回组件从C:\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \临时ASP.NET Files\sems\cd484e8d\a29ce80f\assembly\dl3\63ae24d2\b8096e5c_94f5cb01\Atalasoft.dotImage.AdvancedDocClean.dll.
日志:大会默认加载上下文中加载。
 
未能加载文件或程序集或它的某一个依赖项

修改

从.cpp的codeProvider输出无法加载

  ***大会粘结剂日志条目(4/11/2011 @下午2时37分42秒)***

操作失败。
绑定结果:HR = 0x80070002。该系统找不到指定的文件。

C:从装配​​经理装\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \ clr.dll
下可执行的C运行:\ WINDOWS \ Syswow64资料\ INETSRV \程序w3wp.exe
---详细的错误日志如下。

=== pre-绑定状态信息===
日志:用户= NT AUTHORITY \ NETWORK SERVICE
日志:显示名称= .cpp的codeProvider,版本= 10.0.0.0,文化=中性公钥= b03f5f7f11d50a3a
 (完全限定)
日志:应用平台=文件:/// K:/应用/ PRD / SEMS / ASP / SEMS /
LOG:初始PrivatePath = K:\ APP \珠三角\ SEMS \ ASP \ SEMS \ BIN
日志:动基座= C:\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \临时ASP.NET文件\ SEMS \ cd484e8d
日志:缓存基地= C:\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \临时ASP.NET文件\ SEMS \ cd484e8d
LOG:AppName的= a29ce80f
调用汇编:(未知)。
===
日志:此绑定从default加载上下文。
日志:正在使用应用程序配置文件:K:\ APP \珠三角\ SEMS \ ASP \ SEMS \ web.config中
日志:使用主机配置文件:\\ \ C:\ WINDOWS \ microsoft.net \框架\ v4.0.30319 \ aspnet.config
日志:从C使用计算机配置文件:\ WINDOWS \ Microsoft.NET \框架\ v4.0.30319 \ CONFIG \ machine.config中。
日志:后政策参考:.cpp的codeProvider,版本= 10.0.0.0,文化=中性公钥= b03f5f7f11d50a3a
日志:GAC查找不成功。
日志:新的URL文件试图下载:/// C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET文件/ SEMS / cd484e8d / a29ce80f / CPP codeProvider.DLL。
日志:新的URL文件试图下载:/// C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET文件/ SEMS / cd484e8d / a29ce80f / CPP codeProvider / CPP codeProvider .DLL。
日志:新的URL文件试图下载:/// K:/App/Prd/SEMS/asp/sems/bin/Cpp$c$cProvider.DLL。
日志:新的URL文件试图下载:/// K:/App/Prd/SEMS/asp/sems/bin/Cpp$c$cProvider/Cpp$c$cProvider.DLL。
日志:新的URL文件试图下载:/// C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET文件/ SEMS / cd484e8d / a29ce80f / CPP codeProvider.EXE。
日志:新的URL文件试图下载:/// C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET文件/ SEMS / cd484e8d / a29ce80f / CPP codeProvider / CPP codeProvider 。可执行程序。
日志:新的URL文件试图下载:/// K:/App/Prd/SEMS/asp/sems/bin/Cpp$c$cProvider.EXE。
日志:新的URL文件试图下载:/// K:/App/Prd/SEMS/asp/sems/bin/Cpp$c$cProvider/Cpp$c$cProvider.EXE。
日志:所有探测网址企图失败了。
 

解决方案

嗯,这似乎缺少的依赖是 Atalasoft.dotImage.AdvancedDocClean.DLL 。当您在2008年的机器上运行这个,你从那里这个DLL被加载知道吗?你有在本地部署在Web应用程序的bin目录下,或者是在该计算机上的某个地方安装,或者安装在GAC?

另一个要检查的是你正在运行的.NET在两台机器上的版本相同。如果说2008年机器运行.NET 4,和2003年的机器是不是,你可以不加载同一个DLL文件。

调试组件加载问题的一个有用的工具是融合。融合日志自带.NET,你只需要启用它,并使用融合日志查看器:

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

I am getting the following error when trying to run a web application:

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.

I am running on Windows Server 2003 & .NET Framework 4.0. The same binaries and dll's are running successfully on a Windows Server 2008 R2 server.

How can I find out which dependency is failing to load?

Edit

Fusion logging shows the following:

*** 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.

Edit

Output from CppCodeProvider that failed to load

*** 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.

解决方案

Well, the dependency that seems to be missing is Atalasoft.dotImage.AdvancedDocClean.DLL. When you run this on the 2008 machine, do you know from where this DLL is being loaded? Do you have it locally deployed in the bin directory of the web app, or is it installed somewhere on that machine, or installed in the GAC?

Another thing to verify is that you're running the same version of .NET on both machines. If the 2008 machine is running .NET 4, and the 2003 machine is not, you may not be loading the same DLLs.

A useful tool for debugging assembly loading problems is Fusion. Fusion logging comes with .NET, you just need to enable it, and use the Fusion Log Viewer:

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