Could not load file or assembly 'System.Data.SQLite'

1,613 views
Skip to first unread message

J. Pablo Fernández

unread,
Aug 15, 2009, 9:32:12 AM8/15/09
to ELMAH, dmag...@crystalgears.com
I've installed ELMAH 1.1 .Net 3.5 x64 in my ASP.NET project and now
I'm getting this error (whenever I try to see any page):

Could not load file or assembly 'System.Data.SQLite, Version=1.0.61.0,
Culture=neutral, PublicKeyToken=db937bc2d44ff139' 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 'System.Data.SQLite, Version=1.0.61.0, Culture=neutral,
PublicKeyToken=db937bc2d44ff139' or one of its dependencies. An
attempt was made to load a program with an incorrect format.

More error details at the bottom.

My Active Solution platform is "Any CPU" and I'm running on a x64
Windows 7 on an x64, of course, processor. The reason why we are using
this version of ELMAH is because 1.0 .Net 3.5 (x86, which is the only
platform for which it's compiled) gave us this same error on our x64
Windows server.

I've tried compiling for x86 and x64 and I get the same error. I've
tried removing the all compiler output (bin and obj). Finally I've
made a reference to the SQLite dll directly, something that was not
needed for the project to work on the server and I've got this
compiler error:

Error 1 Warning as Error: Assembly generation -- Referenced assembly
'System.Data.SQLite.dll' targets a different processor MyProject

Any ideas what the problem might be?

More error details:

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.

Stack Trace:

[BadImageFormatException: Could not load file or assembly
'System.Data.SQLite, Version=1.0.61.0, Culture=neutral,
PublicKeyToken=db937bc2d44ff139' 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.nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint,
StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean
forIntrospection) +43
System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean
forIntrospection) +127 System.Reflection.Assembly.InternalLoad(String
assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark,
Boolean forIntrospection) +142 System.Reflection.Assembly.Load(String
assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String
assemblyName, Boolean starDirective) +46

[ConfigurationErrorsException: Could not load file or assembly
'System.Data.SQLite, Version=1.0.61.0, Culture=neutral,
PublicKeyToken=db937bc2d44ff139' 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) +613
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory
() +203 System.Web.Configuration.CompilationSection.LoadAssembly
(AssemblyInfo ai) +105
System.Web.Compilation.BuildManager.GetReferencedAssemblies
(CompilationSection compConfig) +178
System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath
configPath, Boolean supportLocalization, String outputAssemblyName)
+54
System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult
(Boolean isPrecompiledApp) +232
System.Web.Compilation.BuildManager.CompileGlobalAsax() +52
System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +337

[HttpException (0x80004005): Could not load file or assembly
'System.Data.SQLite, Version=1.0.61.0, Culture=neutral,
PublicKeyToken=db937bc2d44ff139' or one of its dependencies. An
attempt was made to load a program with an incorrect format.]
System.Web.Compilation.BuildManager.ReportTopLevelCompilationException
() +58 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled
() +512 System.Web.Hosting.HostingEnvironment.Initialize
(ApplicationManager appManager, IApplicationHost appHost,
IConfigMapPathFactory configMapPathFactory,
HostingEnvironmentParameters hostingParameters) +729

[HttpException (0x80004005): Could not load file or assembly
'System.Data.SQLite, Version=1.0.61.0, Culture=neutral,
PublicKeyToken=db937bc2d44ff139' or one of its dependencies. An
attempt was made to load a program with an incorrect format.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8896783
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +85
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
+259

James_2JS

unread,
Aug 16, 2009, 10:02:09 AM8/16/09
to ELMAH
Hi there,

Take a look at issue 98 (http://code.google.com/p/elmah/issues/detail?
id=98)

As you will see, this issue is fixed in ELMAH 1.1. You can download
the release candidate here http://code.google.com/p/elmah/downloads/detail?name=ELMAH-1.1-RC-bin-x64.zip
Or if you can wait a few days, this will go RTM.

Cheers,

James
> System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainB­inDirectory

Rashim Uddin

unread,
Nov 7, 2013, 12:10:07 PM11/7/13
to el...@googlegroups.com, dmag...@crystalgears.com, pup...@pupeno.com
I was facing this type of weird problem and finally resolve it. You also might try with that.Please have a look on that.
Reply all
Reply to author
Forward
0 new messages