I previously had a working console application project that will read and write settings to a local SQLite database file.
Based on this project, I converted it to a windows service project by porting over the classes and use the ServiceBase class to create the the service.
However, each time I run the service, I keep getting an SqliteException
with the Message SQLite Error 1: 'no such table: Settings'.
Using DB Browser for SQLite
, I do see the table present in the database file so I am not sure what is going on.
I have tried testing with my own account using Windows Service, I have tried giving Local System access to my build folder for testing.
I am not sure if this helps but I have also included part of the DbContext file:
public class CDIContext : DbContext
{
public DbSet<Setting> Settings { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
options.UseSqlite("Data Source=ApplicationData.db");
}
}
public class Setting
{
[Key]
public Int32 Id { get; set; }
[Required]
public Int64 LastUpdateEpochUTC { get; set; }
}