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

发布于 2024-08-02 02:51:13 字数 4142 浏览 8 评论 0原文

我已经在 ASP.NET 项目中安装了 ELMAH 1.1 .Net 3.5 x64,现在我收到此错误(每当我尝试查看任何页面时):

无法加载文件或程序集 'System.Data.SQLite,版本=1.0.61.0, 文化=中立, PublicKeyToken=db937bc2d44ff139' 或 它的依赖项之一。 一次尝试 被用来加载一个程序 格式不正确。

描述:一个 期间发生未处理的异常 当前网络的执行 要求。 请检查堆栈跟踪 有关错误的更多信息 以及它在代码中的起源。

异常详细信息: System.BadImageFormatException:可以 不加载文件或程序集 'System.Data.SQLite,版本=1.0.61.0, 文化=中立, PublicKeyToken=db937bc2d44ff139' 或 它的依赖项之一。 一次尝试 被用来加载一个程序 格式不正确。

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

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

我尝试编译 x86 和 x64,但出现相同的错误。 我尝试删除所有编译器输出(bin 和 obj)。 最后,我直接引用了 SQLite dll,这是该项目在服务器上运行不需要的东西,并且出现了以下编译器错误:

错误 1 ​​警告为错误:程序集生成 - 引用的程序集“System.Data.SQLite.dll”针对不同的处理器 MyProject

知道问题可能是什么吗?

更多错误详细信息:

来源错误:

生成了未处理的异常 当前执行期间 网络请求。 有关信息 异常的起源和地点 可以使用异常来识别 下面的堆栈跟踪。

堆栈跟踪:

[BadImageFormatException:无法 加载文件或程序集 'System.Data.SQLite,版本=1.0.61.0, 文化=中立, PublicKeyToken=db937bc2d44ff139' 或 它的依赖项之一。 一次尝试 被用来加载一个程序 格式不正确。]
System.Reflection.Assembly._nLoad(AssemblyName 文件名、字符串代码库、证据 装配安全、装配 locationHint、StackCrawlMark& 堆栈标记、布尔值 throwOnFileNotFound,布尔值 用于内省)+0
System.Reflection.Assembly.nLoad(AssemblyName 文件名、字符串代码库、证据 装配安全、装配 locationHint、StackCrawlMark& 堆栈标记、布尔值 throwOnFileNotFound,布尔值 用于内省)+43
System.Reflection.Assembly.InternalLoad(AssemblyName 装配参考、证据 assemblySecurity、StackCrawlMark& stackMark,用于自省的布尔值) +127 System.Reflection.Assembly.InternalLoad(字符串 汇编字符串,证据 assemblySecurity、StackCrawlMark& stackMark,用于自省的布尔值) +142 System.Reflection.Assembly.Load(字符串 汇编字符串)+28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(字符串 程序集名称,布尔星指令) +46

[配置错误异常:可以 不加载文件或程序集 'System.Data.SQLite,版本=1.0.61.0, 文化=中立, PublicKeyToken=db937bc2d44ff139' 或 它的依赖项之一。 一次尝试 被用来加载一个程序 格式不正确。]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(字符串 程序集名称,布尔星指令) +613 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +203 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo 艾)+105
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)+178
System.Web.Compilation.BuildProvidersCompiler..ctor(虚拟路径 配置路径,布尔值 支持本地化、字符串 输出程序集名称)+54
System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(布尔值 isPrecompiledApp) +232
System.Web.Compilation.BuildManager.CompileGlobalAsax() +52 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +337

[HttpException (0x80004005):无法 加载文件或程序集 'System.Data.SQLite,版本=1.0.61.0, 文化=中立, PublicKeyToken=db937bc2d44ff139' 或 它的依赖项之一。 一次尝试 被用来加载一个程序 格式不正确。]
System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +58 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +512 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager,IApplicationHost appHost, IConfigMapPathFactory 配置MapPathFactory, 托管环境参数 托管参数)+729

[HttpException (0x80004005):无法 加载文件或程序集 'System.Data.SQLite,版本=1.0.61.0, 文化=中立, PublicKeyToken=db937bc2d44ff139' 或 它的依赖项之一。 一次尝试 被用来加载一个程序 格式不正确。]
System.Web.HttpRuntime.FirstRequestInit(HttpContext 上下文)+8896783
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext 上下文)+85
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest 写)+259

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(20

哆兒滾 2024-08-09 02:51:13

System.Data.SQLite.dll 是一个混合程序集,即它同时包含托管代码和本机代码。 因此,特定的 System.Data.SQLite.dll 要么是 x86,要么是 x64,但绝不会同时是两者。

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

另一种选择是不使用 Cassini,而使用 IIS7,它是正确的 x64。

System.Data.SQLite.dll is a mixed assembly, i.e. it contains both managed code and native code. Therefore a particular System.Data.SQLite.dll is either x86 or x64, but never both.

Update (courtesy J. Pablo Fernandez): Cassini, the development web server used by Visual Studio when you press F5 or click the green «play» button, is x86 only which means that even if your workstation is x64, you'll only be able to use the x86 version of System.Data.SQLite.dll.

An alternative is not to use Cassini but IIS7 which is properly x64.

无力看清 2024-08-09 02:51:13

确保应用程序池的“启用 32 位应用程序”设置为 false。

Make sure that "Enable 32 - Bit Applications" is set to false for the app pool.

少钕鈤記 2024-08-09 02:51:13

转到IIS7应用程序池-> 高级设置并将 32 位应用程序设置为 true

Go to the IIS7 Application Pool -> advanced settings and set the 32-bit application to true.

呢古 2024-08-09 02:51:13

如果您不使用 SQLite,这非常简单:

您可以从解决方案的 bin 文件夹中删除 SQLite DLL,然后从引用 ELMAH 的文件夹中删除。 重新构建,您的应用程序将不会尝试加载您未使用的这个 DLL。

This is very simple if you are not using SQLite:

You can delete the SQLite DLLs from your solution's bin folders, then from the folder where you reference ELMAH. Rebuild, and your app won't try to load this DLL that you are not using.

感情旳空白 2024-08-09 02:51:13

我有一台 64 位开发机器和 32 位构建服务器。 我在 NHibernate 初始化之前使用了这段代码。 在任何架构上都有魅力(以及我测试过的 2 个架构)

希望这对某人有帮助。

吉多

        private static void LoadSQLLiteAssembly()
        {
            Uri dir = new Uri(Assembly.GetExecutingAssembly().CodeBase);
            FileInfo fi = new FileInfo(dir.AbsolutePath);           
            string binFile = fi.Directory.FullName + "\\System.Data.SQLite.DLL";
            if (!File.Exists(binFile)) File.Copy(GetAppropriateSQLLiteAssembly(), binFile, false);
        }

        private static string GetAppropriateSQLLiteAssembly()
        {
            string pa = Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE");
            string arch = ((String.IsNullOrEmpty(pa) || String.Compare(pa, 0, "x86", 0, 3, true) == 0) ? "32" : "64");
            return GetLibsDir() + "\\NUnit\\System.Data.SQLite.x" + arch + ".DLL";
        }

I have a 64 bit dev machine and 32 bit build server. I used this code prior to NHibernate initialisation. Works a charm on any architecture (well the 2 I have tested)

Hope this helps someone.

Guido

        private static void LoadSQLLiteAssembly()
        {
            Uri dir = new Uri(Assembly.GetExecutingAssembly().CodeBase);
            FileInfo fi = new FileInfo(dir.AbsolutePath);           
            string binFile = fi.Directory.FullName + "\\System.Data.SQLite.DLL";
            if (!File.Exists(binFile)) File.Copy(GetAppropriateSQLLiteAssembly(), binFile, false);
        }

        private static string GetAppropriateSQLLiteAssembly()
        {
            string pa = Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE");
            string arch = ((String.IsNullOrEmpty(pa) || String.Compare(pa, 0, "x86", 0, 3, true) == 0) ? "32" : "64");
            return GetLibsDir() + "\\NUnit\\System.Data.SQLite.x" + arch + ".DLL";
        }
客…行舟 2024-08-09 02:51:13

我通过安装带有 Nuget 扩展的 System.Data.SQLite 解决了这个问题。 此扩展可用于 Visual Studio 2010 或更高版本。
首先,您必须安装 Nuget 扩展。 您可以在此处进行操作:

  • 转到 Visual Studio 2010,菜单 --> 工具
  • 选择 Extension Manager
  • 在搜索框中输入 NuGet,然后单击 Online Gallery。 等待检索信息...
  • 选择检索到的 NuGet Package Manager,单击“下载”。 等待下载…
  • 单击 Visual Studio 扩展安装程序 NuGet 包管理器上的“安装”。 等待安装完成。
  • 单击“关闭”并“立即重新启动”。

其次,现在你可以安装SQLite了:

现在,您可以使用系统.数据.SQLite。

在本例中,您会看到两个文件夹 x64 和 x86,这些文件夹包含 SQLite.Interop.dll。 现在转到这些 dll 的属性窗口,并将构建操作设置为内容,将复制到输出目录设置为始终复制。

所以,这就是我的方式。

谢谢。
金涛范,
越南胡志明市。
电子邮件:[电子邮件受保护]

I resolved this by installing System.Data.SQLite with Nuget extension. This extension can use for Visual Studio 2010 or higher.
First, you have to install Nuget extension. You can follow here:

  • Go to Visual Studio 2010, Menu --> Tools
  • Select Extension Manager
  • Enter NuGet in the search box and click Online Gallery. Waiting it Retrieve information…
  • Select the retrieved NuGet Package Manager, click Download. Waiting it Download…
  • Click Install on the Visual Studio Extension Installer NuGet Package Manager. Wait for the installation to complete.
  • Click Close and 'Restart Now.

Second, now, you can install SQLite:

And now, you can use System.Data.SQLite.

In the case, you see two folder x64 and, x86, these folders contain SQLite.Interop.dll. Now go to the properties windows of those dlls and set build action is content and Copy to output directory is Copy always.

So, that is my way.

Thanks.
Kim Tho Pham,
HoChiMinh City, Vietnam.
Email: [email protected]

烟织青萝梦 2024-08-09 02:51:13

在我们的例子中不起作用,因为我们的生产服务器缺少

Microsoft Visual C++ 2010 SP1 Redistributable Package (x86)

我们安装了它并且一切正常。 应用程序池必须将“启用 32 位应用程序”设置为 true,并且您必须使用 x86 版本的库

In our case didn't work because our production server has missing

Microsoft Visual C++ 2010 SP1 Redistributable Package (x86)

We installed it and all work fine. The Application Pool must have Enable 32-bit Applications set to true and you must the x86 version of the library

多情出卖 2024-08-09 02:51:13

作为一个必须处理 Roadkill Wiki 上相当多具有完全相同问题的错误报告的人,这就是您需要做的:

  • 您使用的是 x64 还是 x86? Sqlite 附带了用于单独架构的 DLL - 将正确的 DLL 复制到您的 bin 文件夹中,官方提供程序有两个 DLL: System.Data.SQLite.dll System.Data.SQLite.Linq .dll
  • 如果您不想费心寻找这些程序集,请为您的应用程序池启用 32 位模式(通常仅适用于开发计算机的解决方案)
  • 如果您托管在服务器上,则需要Microsoft C++ Runtime 可再发行组件 - 默认情况下,它未安装在 Server 2008 R2 上。 x64 版本x86 版本

重新启动时要跳过多少圈真是太痛苦了- 分发 SQLite .NET 二进制文件,我最终的 Roadkill 解决方案是根据您使用的体系结构将正确的二进制文件复制到 ~/bin 文件夹。 不幸的是,这并不能解决 C++ 运行时问题。

As someone who's had to deal with quite a few bug reports on Roadkill Wiki with exactly the same issue, this is what you need to do:

  • Are you using x64 or x86? Sqlite comes with DLLs for separate architectures - copy the right one to your bin folder, there are two DLLS for the official provider: System.Data.SQLite.dll System.Data.SQLite.Linq.dll
  • If you can't be bothered hunting around for these assemblies, enable 32 bit mode for your App Pool (a solution for dev machines only usually)
  • If you're hosting on a server, you'll need the Microsoft C++ Runtime redistributable - it's not installed on Server 2008 R2 by default. x64 version, x86 version

It's a real pain in the ass how many hoops you have to jump through when re-distributing the SQLite .NET binaries, my solution for Roadkill in the end was to copy the correct binaries to the ~/bin folder based on the architecture your using. Unfortunately that doesn't solve the C++ runtime issue.

梦幻之岛 2024-08-09 02:51:13

手动加载相关的 System.Data.SQLite 程序集可以解决此问题。

更改了gatapia的代码如下:

    public static void LoadSQLLiteAssembly()
    {
        Uri dir = new Uri(Assembly.GetExecutingAssembly().CodeBase);
        FileInfo fi = new FileInfo(dir.AbsolutePath);
        string appropriateFile = Path.Combine(fi.Directory.FullName, GetAppropriateSQLLiteAssembly());
        Assembly.LoadFrom(appropriateFile);
    }

    private static string GetAppropriateSQLLiteAssembly()
    {
        string pa = Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE");
        string arch = ((String.IsNullOrEmpty(pa) || String.Compare(pa, 0, "x86", 0, 3, true) == 0) ? "32" : "64");
        return "System.Data.SQLite.x" + arch + ".DLL";
    }

Manual load related System.Data.SQLite assembly can resolve this.

Changed gatapia's Code as below:

    public static void LoadSQLLiteAssembly()
    {
        Uri dir = new Uri(Assembly.GetExecutingAssembly().CodeBase);
        FileInfo fi = new FileInfo(dir.AbsolutePath);
        string appropriateFile = Path.Combine(fi.Directory.FullName, GetAppropriateSQLLiteAssembly());
        Assembly.LoadFrom(appropriateFile);
    }

    private static string GetAppropriateSQLLiteAssembly()
    {
        string pa = Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE");
        string arch = ((String.IsNullOrEmpty(pa) || String.Compare(pa, 0, "x86", 0, 3, true) == 0) ? "32" : "64");
        return "System.Data.SQLite.x" + arch + ".DLL";
    }
枯寂 2024-08-09 02:51:13

当我们的 Windows 服务器从 32 位操作系统转换为 64 位操作系统时,我收到此错误。 引发错误的程序集被设置为在 x86 模式(即 32 模式)下编译。 我将其切换为“任何 CPU”,这样就成功了。 您可以通过执行以下操作来更改此值:

右键单击项目,转到“属性”->“属性”。 构建-> 平台目标-> 更改为“任何CPU”

I got this error when our windows server was converted from 32 bit OS to 64 bit. The assembly that was throwing the error was set to compile in x86 mode (ie 32 mode). I switched it to "Any CPU" and that did the trick. You can change this value by doing the following:

right click on the project go to Properties -> Build -> Platform Target -> change to "Any CPU"

水染的天色ゝ 2024-08-09 02:51:13

奇怪的是,我通过 Nuget GUI 应用程序(而不是包管理器控制台)安装 System.Data.SQLite 解决了这个问题。

通过控制台安装不包含该库需要运行的依赖项。

I resolved this, oddly enough, by installing System.Data.SQLite via the Nuget GUI application, as opposed to the package manager console.

Installing via the console didn't include the dependencies this library needs to run.

烟若柳尘 2024-08-09 02:51:13

System.Data.SQLite 依赖于 System.Data.SQLite.interop,请确保两个包的版本相同并且都是 x86

这是一个老问题,但我尝试了以上所有方法。 我正在开发一个严格的x86项目,因此没有两个文件夹/x86、/x64。 但由于某种原因,System.Data.SQLiteSystem.Data.SQLite.interop 是不同的版本,一旦我拉下匹配的 dll,问题就得到了解决。

System.Data.SQLite has a dependency on System.Data.SQLite.interop make sure both packages are the same version and are both x86.

This is an old question, but I tried all the above. I was working on a strictly x86 project, so there was not two folders /x86, /x64. But for some reason, the System.Data.SQLite was a different version to System.Data.SQLite.interop, once I pulled down matching dlls the problem was fixed.

柳絮泡泡 2024-08-09 02:51:13

我想出了两个快速解决方案。 要么为我工作。 我认为问题是因为权限。

1)我没有使用 net-2.0 目录中的 Elmah.dll 文件,而是使用 net-1.1 中的 Elmah.dll 。

2)而不是将Elmah.dll保留在项目bin目录中。 我创建了一个dll目录来放置它。

I came up with 2 quick solutions. Either work for me. I think the problem is because of permissions.

1) Instead of using the Elmah.dll file from the net-2.0 directory, I used Elmah.dll from net-1.1 .

2) Instead of keeping Elmah.dll in the project bin directory. I make a dll directory to put it in.

烟酉 2024-08-09 02:51:13

解决此问题的另一种方法是将应用程序升级到 ELMAH 1.2 而不是 1.1。

Another way to get around this is just to upgrade your application to ELMAH 1.2 rather than 1.1.

帅哥哥的热头脑 2024-08-09 02:51:13

使用 Visual Studio 2022,我在使用 IIS Express 时将位数设置为 x86 而不是默认值。 这解决了问题,而无需更改任何二进制文件。
输入图片此处描述

Using Visual Studio 2022, I set the Bitness to x86 instead of Default while using IIS Express. That fixed the issue without having to change any binaries.
enter image description here

不寐倦长更 2024-08-09 02:51:13

你能删除你的bin debug文件夹并重新编译吗?

或者检查您的项目对 System.Data.SQLite 的引用,找到它所在的位置,然后在反射器中打开 dll。 如果无法打开它,则意味着 dll 已损坏,您可能需要找到一个正确的 dll 或重新安装 .net 框架。

Can you delete your bin debug folder and recompile again?

Or check your project reference to the System.Data.SQLite, track down where it is located, then open the dll in reflector. If you can't open it, that means that the dll is corrupted, you might want to find a correct one or reinstall the .net framework.

婴鹅 2024-08-09 02:51:13

如果您使用 IIS Express 作为开发计算机上的 Web 服务器,我将更改为本地 IIS。 这对我有用。

If you are using IIS Express as the web server on your development machine I would change to Local IIS. This worked for me.

心如狂蝶 2024-08-09 02:51:13

这是一篇旧帖子,但它可能会帮助一些搜索此错误的人尝试将应用程序池的“启用 32 位应用程序”设置为 True。 这就是为我解决错误的原因。 我通过阅读 @beckelmw 答案的一些评论找到了这个解决方案。

This is an old post, but it may help some people searching on this error to try setting "Enable 32-Bit Applications" to True for the app pool. That is what resolved the error for me. I came upon this solution by reading some the comments to @beckelmw's answer.

近箐 2024-08-09 02:51:13

您可能安装了错误的软件包。 您需要 Microsoft 生成的包,它实现了 System.Data.Common提供商模型。

You likely have the wrong package installed. You want the package produced by Microsoft which implements the System.Data.Common provider model.

挖个坑埋了你 2024-08-09 02:51:13

由于所有解决方案都不适合我,我尝试了以下方法:
我删除了这个文件夹 C:\Users....nuget\packages\stub.system.data.sqlite.core.netframework
然后我从 Nuget Package Manager 安装了 System.Data.SQLite.Core
还有“哇!!!” 有用,

As all solutions didn't work for me, I tried this:
I deleted this folder C:\Users....nuget\packages\stub.system.data.sqlite.core.netframework
Then I installed System.Data.SQLite.Core from Nuget Package Manager
And "wow!!!!" it works,

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文