我已经在我的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。 (编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|