• RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube

Am facut un deploy cu o aplicatie ASP.NET pe un server pe care avem Windows Server 2008 R2 Datacenter, 64-bit.

Desi pe local aplicatia functiona bine, dupa deploy a aparut urmatoarea erroare:

Could not load file or assembly ‘Name’ or one of its dependencies. An attempt was made to load a program with an incorrect format.

Amluat la intrebari pe prietenul Google si zicea ca eroarile de genul acesta apar daca IIS-ul ruleaza pe un server 64-bit si aplicatia este setata sa faca build avand target platform 32-bit. (se poate verifica asta dand click dreapta pe project / Properties / Build. Daca acolo apare x86, nu-i bine. :D )

Ei, bine. La noi nu era target platform x86, in plus pe local mergea (si local avem tot OS pe 64-bit). DAR in project se folosea un dll care era pe 64-bit.

Ce-i de facut in cazul asta?

In cazul acesta, te duci fain-frumos pe server in IIS Manager la application pool-ul sub care ruleaza aplicatia, selectezi Advanced Settings si acolo gasesti setarea magica: “Enable 32-Bit Applications”.


Default este pe false. Am pus-o pe true si aplicatia a mers ca minunea. :D

Iata si un exemplu de erroare despre care vorbeam:

Server Error in ‘/’ Application.


Could not load file or assembly ‘XMLView’ 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 ‘XMLView’ 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 ‘XMLView’ could not be loaded.
=== Pre-bind state information === LOG: User = NT AUTHORITY\NETWORK SERVICE LOG: DisplayName = XMLView (Partial) LOG: Appbase = file:///C:/dev/Projects/OSCARUtils/ LOG: Initial PrivatePath = C:\dev\Projects\OSCARUtils\bin Calling assembly : (Unknown). === LOG: This bind starts in default load context. LOG: Using application configuration file: C:\dev\Projects\OSCARUtils\web.config LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\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/Framework64/v2.0.50727/Temporary ASP.NET Files/root/8a8c3f22/9d24bab0/XMLView.DLL. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/Temporary ASP.NET Files/root/8a8c3f22/9d24bab0/XMLView/XMLView.DLL. LOG: Attempting download of new URL file:///C:/dev/Projects/OSCARUtils/bin/XMLView.DLL. ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
Stack Trace:
[BadImageFormatException: Could not load file or assembly ‘XMLView’ or one of its dependencies. An attempt was made to load a program with an incorrect format.] System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0 System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +465 System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +181 System.Reflection.Assembly.Load(String assemblyString) +42 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +190 [ConfigurationErrorsException: Could not load file or assembly ‘XMLView’ or one of its dependencies. An attempt was made to load a program with an incorrect format.] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +3637752 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +397 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +155 System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +36 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +235 System.Web.Compilation.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir) +214 System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors) +57 System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +259 System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +406 System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +125 System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +203 System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +52 System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +50 System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +410 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +274


Version Information:Microsoft .NET Framework Version:2.0.50727.1378; ASP.NET Version:2.0.50727.1378

posted on Monday, November 05, 2007 2:49 PM |
   

Comentarii Facebook

6 comentarii pana acum. Si tu poti sa comentezi!

  1. AdiP spune:

    am fost primu si o zis ca ii prea mic …. commentu
    da, acum se pare ca am ce scrie si poate poate… il accepta wp-ul

  2. AdiP spune:

    AdiP spune:
    Comentariul tău e în așteptare.
    14 ianuarie 2011 la 17:14
    …………………….

    pfooooooooooi, in asteptare

  3. AlexB spune:

    ti-a mes pana la urma. apreciem perseverenta ta. :)

  4. Radu spune:

    foarte util postul, cred ca si eu m-am intalnit cu ceva asemanator candva

  5. Roby Apps spune:

    Cred ca era o malformatie de dll daca era la 63 de biti :D ;) cred ca unul din ei a luat-o la fuga :D

  6. AlexB spune:

    :)) am correctat. multumesc! :D