ASP.Net Load Error - Could not load file or assembly or one of its dependencies

These days I am in process of moving our applications to new shiny Windows 2008 R2 server with SQL Server 2008 R2. When I moved one of sites to the server and tried to access it, I ran into the following error.

=== Pre-bind state information ===
LOG: User = NT AUTHORITY\NETWORK SERVICE
LOG: DisplayName = ByteBlocks.BlogEngineAdvertising
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: ByteBlocks.BlogEngineAdvertising | Domain ID: 104
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:///C:/WebSites/Portals/byteblocks.com/ByteBlocks_BE20/
LOG: Initial PrivatePath = \Portals\byteblocks.com\ByteBlocks_BE20\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: \Portals\byteblocks.com\ByteBlocks_BE20\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\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/Framework64/v4.0.30319/Temporary ASP.NET Files/root/
1135033a/438a5be8/ByteBlocks.BlogEngineAdvertising.DLL.
LOG: Attempting download of new URL 
    file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/
    1135033a/438a5be8/ByteBlocks.BlogEngineAdvertising/ByteBlocks.BlogEngineAdvertising.DLL.
LOG: Attempting download of new URL 
file:///Portals/byteblocks.com/ByteBlocks_BE20/bin/ByteBlocks.BlogEngineAdvertising.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.

I was like this site has been running for over 4 years and I never ran into this issue. As you can see from this log that I have detailed information about the binding failure because I have EnableLog entry enabled in Fusion registry node. The information did not help very much because it was saying the same thing that small error message said. So after looking at what changed, I realized that now we have a new server, new operating system and new CPU architecture. And message does say something about wrong format. So I opened the project for that assembly in VS2010. Oh well, there was my DOH! moment. See what I had in build configuration.

visual studio build configuration

Of all over wo dozen assemblies in the project, one was built with x86 option. After I changed to Any CPU, the application was happy as pie. A very hard lesson learned that do not mess with CPU configuration settings unless you are sure that you are never going to deploy on any other CPU architecture. After all .Net code is supposed to compile in IL that is OS and CPU independent unless you want to restrict it for some performance gain.

Search

Social

Weather

18.9 °C / 65.9 °F

weather conditions Mist

Monthly Posts

Blog Tags