Please note that I am running a Windows Service application using the .NET Framework 4.6.2, and only occasionally it gets this error:

2019-04-22 18:35:36.7727|ERROR|DataIntegrator.MyService|ERROR: code = IoErr (10), message = System.Data.SQLite.SQLiteException (0x800007FF): disk I/O error
disk I/O error
   at System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn, String strSql, SQLiteStatement previous, UInt32 timeoutMS, String& strRemain)
   at System.Data.SQLite.SQLiteCommand.BuildNextCommand()
   at System.Data.SQLite.SQLiteDataReader.NextResult()
   at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)
   at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery(CommandBehavior behavior)
   at System.Data.SQLite.SQLiteHelper.Insert(String tableName, Dictionary`2 dic) in C:\Projects\DataIntegrator\DataIntegrator\DataAccessLayer\SQLiteHelper.cs:line 254
   at System.Data.SQLite.Insert.InsertTag(Tag tag) in C:\Projects\DataIntegrator\DataIntegrator\DataAccessLayer\Query\Insert.cs:line 60

Here is my code with the error happening on the sh.Insert line:

    public static void InsertTag(Tag tag)
            using (SQLiteConnection conn = new SQLiteConnection(Constants.DataSource))
                using (SQLiteCommand cmd = new SQLiteCommand())
                    cmd.Connection = conn;

                    SQLiteHelper sh = new SQLiteHelper(cmd);

                    var dic = new Dictionary<string, object>();
                    dic["Id"] = tag.Id;
                    dic["Item"] = tag.Item;
                    dic["Value"] = tag.Value;
                    dic["Source"] = tag.Source;

                    sh.Insert(Constants.TagTable, dic);

        catch (Exception ex)
            LogError("ERROR: {0}", ex.ToString());

Does anyone have any suggestions? Here are some other links I have checked but haven't found a solution yet:

SQLiteDiskIOException with error code 10: disk I/O error

sqlite3 disk I/O error on cli

In the last one it mentions that the database is corrupt but when I stop the console app I can open the database. Should I be using a different database like Berkeley DB that potentially has better performance?


Added OS to tags

0 Answers