无法加载文件或程序集“JsonFx.Json”或其依赖项之一。尝试加载具有错误格式的程序。

4
我正在尝试编译和运行一个包含一些外部DLL的Web应用程序。该应用程序编译时没有错误,但在运行时,我收到以下错误提示:
“无法加载文件或程序集'JsonFx.Json'或其依赖项之一。尝试加载格式不正确的程序。”
解决此问题最常见的两种方法似乎是在IIS服务器中启用32位应用程序,并确保解决方案未以32位模式编译某些项目和64位模式编译其他项目。我已尝试过这两种方法,但都无济于事。
如有任何帮助,将不胜感激。
程序集加载跟踪:
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.

你将应用程序编译成什么? - Daniel Mann
2个回答

2
我假设您是从 Visual Studio 中的 IIS Express 运行此程序。如果项目设置为编译为 64 位而不是 32 位,则需要启用 64 位 IIS Express

步骤:

  1. 导航至:HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\WebProjects
  2. 确保有名为“Use64BitIISExpress”的 REG_DWORD 值。如果没有,请创建它。
  3. 将其值从默认值 0 设置为 1。

谢谢您的建议。不幸的是,这并没有起作用 - 为了澄清,我正在x86模式下运行该项目。 - user1401321

1

我通过重新下载JsonFx.Json.dll解决了问题。我仍然不确定为什么现在它可以工作,这比一开始无法工作更加让人感到不舒服。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接