devbridge / BetterCMS

A publishing focused and developer friendly .NET Open Source CMS.
GNU Lesser General Public License v3.0
374 stars 152 forks source link

Could not load file or assembly 'FluentMigrator.Runner' or one of its dependencies if 32-bit application pool is not enabled #357

Closed pauliusmaciulis closed 11 years ago

pauliusmaciulis commented 11 years ago

Server Error in '/' Application.


Could not load file or assembly 'FluentMigrator.Runner' 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 'FluentMigrator.Runner' 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 'FluentMigrator.Runner' could not be loaded. === Pre-bind state information === LOG: User = IIS APPPOOL\tapestra.local LOG: DisplayName = FluentMigrator.Runner (Partial) WRN: Partial binding information was supplied for an assembly: WRN: Assembly Name: FluentMigrator.Runner | Domain ID: 2 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:///D:/Projects/PetersManagementGroup/Tapestra/Tapestra.Web/ LOG: Initial PrivatePath = D:\Projects\PetersManagementGroup\Tapestra\Tapestra.Web\bin

Calling assembly : (Unknown).

LOG: This bind starts in default load context. LOG: Using application configuration file: D:\Projects\PetersManagementGroup\Tapestra\Tapestra.Web\web.config LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\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/Framework64/v4.0.30319/Temporary ASP.NET Files/root/d31e6323/79914801/FluentMigrator.Runner.DLL. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/d31e6323/79914801/FluentMigrator.Runner/FluentMigrator.Runner.DLL. LOG: Attempting download of new URL file:///D:/Projects/PetersManagementGroup/Tapestra/Tapestra.Web/bin/FluentMigrator.Runner.DLL. ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.

Stack Trace: [BadImageFormatException: Could not load file or assembly 'FluentMigrator.Runner' or one of its dependencies. An attempt was made to load a program with an incorrect format.] System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +210 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +242 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +17 System.Reflection.Assembly.Load(String assemblyString) +35 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +122

[ConfigurationErrorsException: Could not load file or assembly 'FluentMigrator.Runner' 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) +12759734 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +503 System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +142 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +334 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +203 System.Web.Compilation.BuildManager.ExecutePreAppStart() +152 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1151

[HttpException (0x80004005): Could not load file or assembly 'FluentMigrator.Runner' or one of its dependencies. An attempt was made to load a program with an incorrect format.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12880068 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12721257

Audrunas commented 11 years ago

Install FAQ: https://github.com/devbridge/BetterCMS/wiki/Setup-ASP.NET-MVC-3-or-ASP.NET-MVC-4-project

Audrunas commented 11 years ago

Sqllite is not supported: https://github.com/schambers/fluentmigrator/issues/94

Audrunas commented 11 years ago

If I delete Migration.Runner from demo project /bin directory, web site works ok If I copy files from better CMS project's /lib directory, everything seems to be ok.

Maybe nuget must copy migration.runner.dll to project's Lib directory and reference it from that directory ant not from packages?

mwpowellhtx commented 9 years ago

I encountered the same issue the past couple of days.

Audrunas commented 9 years ago

Which version are you using and what's the exception?

mwpowellhtx commented 9 years ago

When I say, 'the same' there's nothing mysterious about that: BadImageFormatException.

The parent project is set to run Any CPU / prefer 32-bit, so I believe things are being coerced to 32-bit since FM assemblies are all 32-bit.

AFAIK, this is based on 'latest' code checked out, or at least branched from, a recent FM version.

More precisely,

[assembly: AssemblyVersion("1.2.1.0")]
[assembly: AssemblyFileVersion("1.2.1.0")]
mwpowellhtx commented 9 years ago

Which 'resolving' that, manifests in a conflict with another dependency I've assumed.

Instead of mucking with decoupling SQLite or anything else that might be pulling it down to the 32-bit realm, I decided to roll my own migrations.

yschkatula commented 8 years ago

Try to add "FluentMigrator.Tools" from NuGet (this is separate package, not so popular and appears at "Page 2" in search results for "FluentMigrator" keyword). This package has AnyCPU build, countrary to FluentMigrator package apparently bundled with x86-only binary for tools subfolder)