無法啟動服務。System.Data.SQLite.SQLiteException (0x80004005): SQL logic error or missing database no such table: hk_AppConfig 在 System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn, String strSql, SQLiteStatement previous, UInt32 timeoutMS, String& strRemain) 在 System.Data.SQLite.SQLiteCommand.BuildNextCommand() 在 System.Data.SQLite.SQLiteCommand.GetStatement(Int32 index) 在 System.Data.SQLite.SQLiteDataReader.NextResult() 在 System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave) 在 System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior) 在 System.Data.SQLite.SQLiteCommand.ExecuteDbDataReader(CommandBehavior behavior) 在 System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) 在 Dapper.SqlMapper.<QueryImpl>d__121`1.MoveNext() 在 System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) 在 System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) 在 Dapper.SqlMapper.Query[T](IDbConnect...
寫了一個windows服務,用控制台測試是沒有問題的,用服務的方式卻根本無法啟動。查看windows事件日志,報以上錯誤。
數據庫配置是這樣的:
<connectionStrings>
<add name="default" connectionString="Data Source= order.sqlite" providerName="System.Data.SQLite"/>
</connectionStrings>
后來看到網上大家都用的是全路徑,隨即修改成這樣:
<connectionStrings>
<add name="default" connectionString="Data Source= E:\訂單服務\order.sqlite" providerName="System.Data.SQLite"/>
</connectionStrings>
Windows服務順利啟動