.net – 无法加载文件或程序集“System.Data.SQLite”

前端之家收集整理的这篇文章主要介绍了.net – 无法加载文件或程序集“System.Data.SQLite”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经在我的ASP.NET项目中安装了ELMAH 1.1 .Net 3.5 x64,现在我得到这个错误(每当我试图看到任何页面):

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,
PublicKeyToken=db937bc2d44ff139’ or
one of its dependencies. An attempt
was made to load a program with an
incorrect format.

底部有更多错误详细信息。

我的活动解决方案平台是“任何cpu”,我运行在x64 Windows 7上的x64,当然,处理器。我们使用这个版本的ELMAH的原因是因为1.0 .Net 3.5(x86,这是唯一的平台编译)给了我们在x64 Windows服务器上这个相同的错误

我试过编译x86和x64和我得到相同的错误。我试图删除所有的编译器输出(bin和obj)。最后,我直接参考了sqlite dll,这是项目不需要在服务器上工作,我有这个编译器错误

Error 1 Warning as Error: Assembly generation — Referenced assembly ‘System.Data.sqlite.dll’ targets a different processor MyProject

任何想法可能是什么问题?

更多错误详细信息:

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,
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,Boolean
forIntrospection) +43
System.Reflection.Assembly.InternalLoad(AssemblyName
assemblyRef,Boolean forIntrospection)
+127 System.Reflection.Assembly.InternalLoad(String
assemblyString,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,
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,
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,
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

System.Data.sqlite.dll是一个混合程序集,即它包含托管代码和本机代码。因此,一个特定的System.Data.sqlite.dll是x86或x64,但从来不是两个。

更新(由J.Pablo Fernandez提供):当您按F5或单击绿色“播放”按钮时,Visual Studio使用的开发Web服务器Cassini是x86,这意味着即使您的工作站是x64,您也只能能够使用x86版本的System.Data.sqlite.dll。

一个替代方案是不使用Cassini,但IIS7是正确的x64。

原文链接:https://www.f2er.com/sqlite/198417.html

猜你在找的Sqlite相关文章