Sistema.BadImageFormatException: No se pudo cargar el archivo o el ensamblaje [duplicar]


Esta pregunta ya tiene una respuesta aquí:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319>InstallUtil.exe C:\_PRODUKCIJA\D
ebug\DynamicHtmlTool.exe
Microsoft (R) .NET Framework Installation utility Version 4.0.30319.1
Copyright (c) Microsoft Corporation.  All rights reserved.

Exception occurred while initializing the installation:
System.BadImageFormatException: Could not load file or assembly 'file:///C:\_PRO
DUKCIJA\Debug\DynamicHtmlTool.exe' or one of its dependencies. An attempt was ma
de to load a program with an incorrect format..

C:\Windows\Microsoft.NET\Framework64\v4.0.30319>

El servicio es x86 compilado incluso ambos equipos son x64 y funciona en mi equipo. Aquí en el servidor donde está win 2008 obtengo este error.

Intento soluciones de Google pero ninguna obrar.

Me gusta escribir aquí tengo proyecto x86 http://www.davesquared.net/2008/12/systembadimageformatexception-on-64-bit.html

 182
Author: Ruben Bartelink, 2011-03-08

5 answers

Parece que está utilizando la versión de 64 bits de la herramienta para instalar una aplicación de arquitectura de 32 bits/x86. Busque la versión de 32 bits de la herramienta aquí:

C:\Windows\Microsoft.NET\Framework\v4.0.30319

Y debería instalar su aplicación de 32 bits muy bien.

 231
Author: madd0,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-01-23 06:51:53

Intente configurar la configuración de sus proyectos, generalmente se debe a problemas de arquitectura x86/x64:

Vaya y establezca su elección como se muestra:

 117
Author: David,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-03-08 07:11:53

Encontré una solución diferente a este problema. Aparentemente mi IIS 7 no tenía el modo de 32 bits activado en mi Grupo de aplicaciones de forma predeterminada.

Para habilitar el modo de 32 bits, abra IIS y seleccione su Grupo de aplicaciones. El mío fue nombrado "ASP.NET v4. 0".
Haga clic derecho, vaya a "Configuración avanzada" y cambie la sección llamada: "Enabled 32-bit Applications" to true.

Reinicie su servidor web e inténtelo de nuevo.

Encontré la solución de este blog referencia: http://darrell.mozingo.net/2009/01/17/running-iis-7-in-32-bit-mode /

Además, puede cambiar la configuración en Visual Studio. En mi caso, fui a Tools > Options > Projects and Solutions > Web Projects y revisé Use the 64 bit version of IIS Express for web sites and projects, esto fue en VS Pro 2015. Nada más lo arregló excepto esto.

 91
Author: Joseph Snow,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-09 15:09:31

Tuve la misma excepción instalando usando el framework correcto.

Mi solución estaba ejecutando cmd como administrador .... entonces funcionó bien.

 5
Author: woony,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-04-12 08:08:28

Mi causa fue diferente Hice referencia a un servicio web y luego recibí este mensaje.

Luego cambié mi destino . Net Framework 4.0 a. Net Framework 2.0 y volví a referir mi servicio web. Después de algunos cambios problema resuelto. No hay error funcionó bien.

Espero que esto ayude!

 3
Author: Davut Gürbüz,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-02-06 12:49:24