系统环境:
Ubuntu18+mono+ASP.NET程序
"错误信息:
System.DllNotFoundException: SQLite.Interop.dll
at (wrapper managed-to-native) System.Data.SQLite.UnsafeNativeMethods.sqlite3_config_none(System.Data.SQLite.SQLiteConfigOpsEnum)
at System.Data.SQLite.SQLite3.StaticIsInitialized () [0x0001d] in <d853410b50bf4819ac0807bfee471b50>:0
at System.Data.SQLite.SQLiteLog.Initialize (System.String className) [0x0003f] in <d853410b50bf4819ac0807bfee471b50>:0
at System.Data.SQLite.SQLiteConnection..ctor (System.String connectionString, System.Boolean parseViaFramework) [0x00046] in <d853410b50bf4819ac0807bfee471b50>:0
at System.Data.SQLite.SQLiteConnection..ctor (System.String connectionString) [0x00000] in <d853410b50bf4819ac0807bfee471b50>:0
at (wrapper remoting-invoke-with-check) System.Data.SQLite.SQLiteConnection..ctor(string)
at SQLiteHelper.Initial (System.String dbPath) [0x0001a] in <d5487d325c234ce6a3961fe3f1199b6c>:0
at XiakeAdbWeb.Api.Run (xEngine.Model.Command command, System.Web.HttpContext thispage) [0x01166] in <d5487d325c234ce6a3961fe3f1199b6c>:0 "
一,参考:
方法一:
wget http://www.sqlite.org/sqlite-autoconf-3070500.tar.gz
tar xvzf sqlite-autoconf-3070500.tar.gz
cd sqlite-autoconf-3070500
./configure
make
sudo make install
方法二:
sudo yum install sqlite-devel
方法三:
sudo gem install sqlite3-ruby
版权声明:本文为CSDN博主「星火燎猿」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/fwj380891124/article/details/53308383
Ubuntu方案:
sudo apt install sqlite
sudo apt-get install sqlite3
二,步奏:
1,安装
wget http://www.sqlite.org/sqlite-autoconf-3070500.tar.gz
tar xvzf sqlite-autoconf-3070500.tar.gz
cd sqlite-autoconf-3070500
./configure
make
sudo make install
这里报了个错,然后我使用下面命令安装
sudo apt install sqlite
sudo apt-get install sqlite3 #执行上条一般会随带安装sqlite3
查看版本:
root@Server:~# sqlite3 -version 3.7.5 root@Server:~# sqlite -version 2.8.17
2,引入文件
上文中Nuget 引入“using Mono.Data.Sqlite;”,我这里还是用的“using System.Data.SQLite;”,第一次没报错,重启后就不行了。所以这里需要改成“using Mono.Data.Sqlite;”。
SQLiteParameter变为:SqliteParameter
SQLiteConnection变为:SqliteConnection
SQLiteCommand变为:SqliteCommand
SQLiteDataAdapter变为:SqliteDataAdapter
SQLiteTransaction变为:SqliteTransaction