2014-09-03 14 views
8

Sto usando la biblioteca Magick.net in un'applicazione web MVC3 e questi sono passi che ho fattoImpossibile caricare il file o il montaggio questione 'Magick.NET-x64' su richiesta MVC

Il mio progetto è il targeting e il mio AnyCPU la macchina è 64 bit
Aggiungere riferimento a Magick.NET-x64.dll al progetto. installata Visual C++ Redistributable per Visual Studio 2012 Update 4 da qui http://www.microsoft.com/en-us/download/details.aspx?id=30679 Installato Ghostscript 9.14 per Windows (64 bit) sulla macchina Aggiunto

<add assembly="Magick.NET-x64, Version=7.0.0.0002, Culture=neutral, PublicKeyToken=2004825badfa91ec" /> 

il file web.config

Progetto è ricostruita con successo [e tutte le DLL sono nella cartella bin anche], ma durante l'esecuzione sto ottenendo le eccezioni

Could not load file or assembly 'Magick.NET-x64' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information > about the error and where it originated in the code.

Exception Details: System.BadImageFormatException: Could not load file or assembly 'Magick.NET-x64' or one of its dependencies. An attempt was > made to load a program with an incorrect format.

Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the > exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Magick.NET-x64' could not be loaded.

=== 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. 
+2

Molto probabile x86/x64 non corrispondente. Sembra che l'assemblaggio a cui fai riferimento sia solo x64 ... Compilare il tuo progetto come AnyCPU in questo caso è pericoloso perché potrebbe essere caricato in un processo a 32 bit (come probabilmente osserverai ora con tutti i log di fusion che hai postato). –

+1

Ho provato anche su x64. Ma le stesse eccezioni si ottengono anche in modalità 64 –

risposta

7

sembra che ci sia un problema durante l'esecuzione di t la versione a 64 bit di Magick.NET in IIS Express di Visual Studio 2013. È necessario set a registry key in base alla seguente risposta 'High quality JPEG compression with c#'. È possibile impostare questo flag o passare alla versione AnyCPU di Magick.NET.

+0

Grazie MOLTO molto. Ho appena spostato da IIS Express a IIS locale e tutto ha funzionato! Avevi ragione, ho usato esplicitamente la versione a 64 bit (non AnyCPU). – Roman

1

Assicurarsi che sia installato anche il pacchetto C++ ridistribuibile.

https://magick.codeplex.com/documentation

Make sure you have installed Visual C++ Redistributable for Visual Studio

.NET 4.0: Visual C++ Redistributable for Visual Studio 2015 (x64 or x86) 
.NET 2.0: Visual C++ Redistributable for Visual Studio 2008 (x64 or x86). 
+1

Questo non è più necessario dal momento che Magick.NET 7.0.0.0020 – dlemstra

+0

@dlemstra su 7.0.1.101, non funziona nemmeno dopo l'installazione di Redattori C++. –

9

una revisione al blog post situata dal @dlemstra è la soluzione più semplice che ho trovato per questo:

Nel VS2013/2015, andare in Strumenti -> Opzioni - > Progetti e soluzioni -> Progetti Web e selezionare "Utilizza la versione a 64 bit di IIS Express per siti Web e progetti".

Use 64 bit IIS Express

Problemi correlati