日期:2014-05-17  浏览次数:20440 次

Win7下IIS访问Sqlite数据库报错
我知道大家都说是64位系统下不能用32位的syste.sqlite.dll。这个我已经换了

VS2008中运行都没问题(同一系统下)

一放到IIS中就报错:

未能加载文件或程序集“System.Data.SQLite”或它的某一个依赖项。试图加载格式不正确的程序。 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 

异常详细信息: System.BadImageFormatException: 未能加载文件或程序集“System.Data.SQLite”或它的某一个依赖项。试图加载格式不正确的程序。

堆栈跟踪: 


[BadImageFormatException: 未能加载文件或程序集“System.Data.SQLite”或它的某一个依赖项。试图加载格式不正确的程序。]
  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) +416
  System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +166
  System.Reflection.Assembly.Load(String assemblyString) +35
  System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +190

[ConfigurationErrorsException: 未能加载文件或程序集“System.Data.SQLite”或它的某一个依赖项。试图加载格式不正确的程序。]
  System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +11207304
  System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +388
  System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +232
  System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +48
  System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +210
  System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +76
  System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +283
  System.Web.Compilation.BuildManager.CompileGlobalAsax() +50
  System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +676

[HttpException (0x80004005): 未能加载文件或程序集“System.Data.SQLite”或它的某一个依赖项。试图加载格式不正确的程序。]
  System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +76
  System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +1012
  System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +1025

[HttpException (0x80004005): 未能加载文件或程序集“System.Data.SQLite”或它的某一个依赖项。试图加载格式不正确的程序。]
  System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11301302
  System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +88
  System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +11174792

 


--------------------------------------------
版本信息: Microsoft .NET Framework 版本:2.0.50727.4927; ASP.NET 版本:2.0.50727.4927 


其它不访问SQLITE数据库的没问题也就是说IIS没问题

------解决方案--------------------
我在美国的一个免费服务器上遇到过这个问题,后来换另一个国内收费服务器就没有问题了。我在其它的收费服务器上也没有遇到。