在AWS EC2上使用SQLite [英] Using SQLite on AWS EC2

查看:185
本文介绍了在AWS EC2上使用SQLite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个Amazon Windows EC2实例上,我在VS2017 Express中创建了一个简单的Windows Forms应用程序,该应用程序仅记录到C:\Data\Databases\File.txt并打开一个sqlite数据库C:\Data\ \数据库base使用实体框架的数据库。

On an Amazon Windows EC2 instance I've created a simple Windows Forms app in VS2017 Express that just logs to C:\Data\Databases\File.txt and opens up a sqlite database C:\Data\Databases\Database.db using Entity framework.

这在安装本地计算机和其他计算机上都可以正常工作。

This works absolutely fine on my local machine and other machines when I install it.

不过,一旦我将其安装到EC2上,它看起来就不会正常运行。

Once I've installed it to the EC2 though, it doesn't look like sqlite works properly. The text log is written to, and when doing a FileExists, the database is found.

但是,一旦它被使用

public class databaseDB : DbContext
{
    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        optionsBuilder.UseSqlite(@"Filename=C:\Data\Databases\Database.db");
    }
}

try
{
    using (databaseDB db = new databaseDB())
    {
       StaticFunctions.WriteToLog("Selecting...");
    }
}
catch (Exception ex)
{
    StaticFunctions.WriteToLog("Error!");
    StaticFunctions.WriteToLog(ex.InnerException.ToString());
}

写入以下错误日志:


System.IO.FileNotFoundException:无法加载文件或程序集'System.ValueTuple,Version = 4.0.2.0,Culture = neutral,PublicKeyToken = cc7b13ffcd2ddd51'或其依赖项之一。该系统找不到指定的文件。
文件名:'System.ValueTuple,Version = 4.0.2.0,Culture = neutral,PublicKeyToken = cc7b13ffcd2ddd51'---> System.IO.FileNotFoundException:无法加载文件或程序集'System.ValueTuple,Version = 4.0 .0.0,Culture = neutral,PublicKeyToken = cc7b13ffcd2ddd51'或其依赖项之一。该系统找不到指定的文件。
文件名:'System.ValueTuple,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = cc7b13ffcd2ddd51'

System.IO.FileNotFoundException: Could not load file or assembly 'System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. File name: 'System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.ValueTuple, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. File name: 'System.ValueTuple, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'

其中我已经阅读了一般,这意味着未正确安装SQLite。我尝试自行注册各种sqlite dll,但一直提示模块已加载,但未找到入口点DllRegisterServer。错误。

which I've read generally it means that SQLite isn't installed properly. I've tried registering various sqlite dll's on their own, but keep getting "The module was loaded but the entry-point DllRegisterServer was not found." error.

我也读过,将sqlite dll复制到应用程序目录有时是可行的,但是由于它是一个应用程序,因此Windows似乎将安装隐藏在我可以安装的位置

I've also read that copying the sqlite dll to the application directory sometimes works, but as it's an app, Windows seems to bury the installation somewhere that I can't get to.

我该怎么做才能使它正常工作?

What can I do to try and get this working?

谢谢! p>

Thanks!

推荐答案

原来是这样的:无法加载文件或程序集'System.ValueTuple'

AWS EC2具有.Net框架4.7.2已安装,而我正在4.6.1中进行开发。在开发人员实例上安装4.7.2后,我遇到了同样的问题,因此更新了项目中的所有Nuget程序包,现在一切正常。

AWS EC2 had .Net framework 4.7.2 installed, and I was developing in 4.6.1. Once I installed 4.7.2 on my developer instance, I had the same issue, so updated all the Nuget packages in the project, and now it all works.

这篇关于在AWS EC2上使用SQLite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆