Jib*_*hew 10 c# assembly-loading asp.net-mvc-3 magick.net
我在mvc3 Web应用程序中使用Magick.net库,这些都是我做的步骤
我的项目是针对AnyCPU,我的机器是64位
将Magick.NET-x64.dll的参考添加到项目中.从此处为Visual Studio 2012 Update 4安装了Visual C++ Redistributable http://www.microsoft.com/en-us/download/details.aspx?id=30679
在计算机上安装了Ghostscript 9.14 for Windows(64位)
<add assembly="Magick.NET-x64, Version=7.0.0.0002, Culture=neutral, PublicKeyToken=2004825badfa91ec" />
Run Code Online (Sandbox Code Playgroud)
在web.config文件上
项目成功重建[并且所有dll也在bin文件夹中],但在运行时我得到例外
无法加载文件或程序集"Magick.NET-x64"或其依赖项之一.尝试加载格式不正确的程序.
描述:执行当前Web请求期间发生未处理的异常.有关错误及其在代码中的起源,请查看堆栈跟踪以获取更多信息.
异常详细信息: System.BadImageFormatException:无法加载文件或程序集"Magick.NET-x64"或其依赖项之一.尝试加载具有不正确格式的程序.
源错误:
在执行当前Web请求期间生成了未处理的异常.可以使用下面的异常堆栈跟踪来识别有关>异常的来源和位置的信息.程序集加载跟踪:以下信息有助于确定无法加载程序集"Magick.NET-x64"的原因.
Run Code Online (Sandbox Code Playgroud)=== Pre-bind state information === LOG: DisplayName = Magick.NET-x64 (Partial) WRN: Partial binding information was supplied for an assembly: WRN: Assembly Name: Magick.NET-x64 | Domain ID: 6 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:/Fagbokforlaget/SourceCodes/fbf_internal/picsilo/Source/ImageTagger/ LOG: Initial PrivatePath = C:\Fagbokforlaget\SourceCodes\fbf_internal\picsilo\Source\ImageTagger\bin Calling assembly : (Unknown). LOG: This bind starts in default load context. LOG: Using application configuration file: C:\Fagbokforlaget\SourceCodes\fbf_internal\picsilo\Source\ImageTagger\web.config LOG: Using host configuration file: 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:/Users/jibinmathew/AppData/Local/Temp/Temporary ASP.NET Files/root/a5b5e44f/dc1c4c69/Magick.NET-x64.DLL. LOG: Attempting download of new URL file:///C:/Users/jibinmathew/AppData/Local/Temp/Temporary ASP.NET Files/root/a5b5e44f/dc1c4c69/Magick.NET-x64/Magick.NET-x64.DLL. LOG: Attempting download of new URL file:///C:/Fagbokforlaget/SourceCodes/fbf_internal/picsilo/Source/ImageTagger/bin/Magick.NET-x64.DLL. ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
在Visual Studio 2013的IIS Express中运行64位版本的Magick.NET时似乎存在问题.您需要根据以下答案" 使用c#进行高质量JPEG压缩 " 来设置注册表项.您可以设置此标志或切换到Magick.NET的AnyCPU版本.