我正在尝试编译和运行一个包含一些外部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.发布于 2014-06-10 16:40:29
我通过重新下载JsonFx.Json.dll来解决这个问题。我仍然不太清楚为什么它现在起作用了,这比一开始就不起作用更让人不舒服。
发布于 2014-06-10 15:18:45
我假设您是在Visual的IIS Express中运行此操作。如果将项目设置为编译为64位而不是32位,则需要启用64位IIS Express。
步骤:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\WebProjectshttps://stackoverflow.com/questions/24143964
复制相似问题