繁体   English   中英

无法加载文件或程序集“JsonFx.Json”或其依赖项之一。 尝试加载格式不正确的程序

[英]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

我正在尝试编译并运行包含一些外部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.

我假设你是从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)。

我通过重新加载JsonFx.Json.dll修复了这个问题。 我现在还不完全确定它为什么会起作用,这比没有首先工作更令人不舒服。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM