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: DisplayName = ByteBlocks.BlogEngineAdvertising
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 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/WebSites/Portals/
LOG: Initial PrivatePath = \Portals\\ByteBlocks_BE20\bin
Calling assembly : (Unknown).
LOG: This bind starts in default load context.
LOG: Using application configuration file: \Portals\\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/
LOG: Attempting download of new URL 
    file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/
LOG: Attempting download of new URL 
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.

comments powered by Disqus




20.6 °C / 69.2 °F

weather conditions Clouds

Monthly Posts

Blog Tags