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

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

概述我已经在我的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 我已经在我的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
is@R_964_3013@App) +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。

总结

以上是内存溢出为你收集整理的.net – 无法加载文件或程序集“System.Data.SQLite”全部内容,希望文章能够帮你解决.net – 无法加载文件或程序集“System.Data.SQLite”所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/1163482.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-01
下一篇 2022-06-01

发表评论

登录后才能评论

评论列表(0条)

保存