Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out which dependency is failing to load

Tags:

.net

asp.net

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.
like image 883
Anthony Avatar asked Apr 11 '11 04:04

Anthony


People also ask

How do I find DLL dependencies?

Goto the download folder, Open "Procexp64.exe" as admin privilege. Open Find Menu-> "Find Handle or DLL" option or Ctrl+F shortcut way. Show activity on this post. Try Dependencies it is described as "An open-source modern Dependency Walker".

How does .NET determine DLL dependencies?

Load your DLL into it, right click, and chose 'Analyze' - you'll then see a "Depends On" item which will show you all the other dll's (and methods inside those dll's) that it needs.

Could not load the file or assembly or one of its dependencies?

In summary if you get the "Could not load file or assembly error", this means that either your projects or their references were built with a reference to a specific version of an assembly which is missing from your bin directory or GAC.

How do you read a dependency walker?

Most load-time problems can be immediately detected by Dependency Walker. When you first open a module in Dependency Walker, it scans that module for all implicit, forward, and delay-load dependencies. Implicit and forward dependencies are required by the operating system in order for the application to run.


2 Answers

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

like image 65
Andy White Avatar answered Nov 12 '22 08:11

Andy White


I see a lot of reference to http://msdn.microsoft.com/en-us/library/e74a18c4(VS.71).aspx

But remember that is .NET 1.1 version and it has the ASP.NET radio button. On the new fusion log you don't have the ASP.NET radio button.

I haven't seen the documentation on how to use the Fusion Log with ASP.NET. Registry key change is an option I see everywhere, but are there any documentation for version 4.0?

Does anyone know?


UPDATE : I found the solution here. I guess, I broke down and started working on the registry.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion

Add:

DWORD ForceLog set value to 1
DWORD LogFailures set value to 1

DWORD LogResourceBinds set value to 1

String LogPath set value to folder for logs ie) C:\FusionLog\

like image 44
Mhoque Avatar answered Nov 12 '22 07:11

Mhoque