4

I'm trying to compile and run a web application that includes some external DLLs.

The application compiles without errors, but when I run it, I receive the following error:

Could not load file or assembly 'JsonFx.Json' or one of its dependencies. An attempt was made to load a program with an incorrect format.

The two most common solutions to this problem seem to be to enable 32-bit applications in the IIS server, and to make sure that the solution is not compiling some projects in 32-bit mode and others in 64-bit mode. I have tried both of these, but to no avail.

Any help would be much appreciated.

Assembly Load Trace:

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: DisplayName = JsonFx.Json
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: JsonFx.Json | Domain ID: 34
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:/workspace/<project name>/source/<project name>/
LOG: Initial PrivatePath = C:\workspace\<project name>\source\<project name>\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\workspace\<project name>\source\<Project name>\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/<project name>/b862caa3/ad6832cd/JsonFx.Json.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/<project name>/b862caa3/ad6832cd/JsonFx.Json/JsonFx.Json.DLL.
LOG: Attempting download of new URL file:///C:/workspace/<project name>/source/<project>/bin/JsonFx.Json.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
user1401321
  • 111
  • 12

2 Answers2

2

I'm assuming you are running this in IIS Express from Visual Studio. If the project is set to compile to 64-bit instead of 32-bit you need to enable 64-bit IIS Express.

Steps:

  1. Navigate to: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\WebProjects
  2. Make sure there is a REG_DWORD value named “Use64BitIISExpress”. If not, create it.
  3. Set its value from 1 (default = 0).
Gariig
  • 131
  • 1
  • 8
  • Thank you for your suggestion. This unfortunately didn't work - To clarify, I'm running the project in x86 mode. – user1401321 Jun 10 '14 at 15:44
1

I fixed the issue by redownloading the JsonFx.Json.dll. I'm still not entirely sure why it works now, which is even more uncomfortable than not having it work in the first place..

user1401321
  • 111
  • 12