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.
4

2 回答 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. 将其值设置为 1(默认值 = 0)。
于 2014-06-10T15:18:45.643 回答
1

我通过重新下载 JsonFx.Json.dll 解决了这个问题。我仍然不完全确定为什么它现在可以工作,这比一开始就没有工作更不舒服..

于 2014-06-10T16:40:29.050 回答