![]() When we made the service account the owner of the parent folder of the file, and gave him write permission, the ACCESS DENIED logs disappeared and the service operated at full speed. The service worked fine and was able to eventually query the data in the file, albeit slowly. ![]() A stand-alone program running as the regular user could open a connection to the same file in the same place in a few milliseconds.Īnalysis of a procmon trace revealed that in the case of the service, we were getting several ACCESS DENIED logs on the file over the course of about 1.5 seconds, that were not present in the trace when running as the regular user. In my case, the SQLite database file was being created by a script run as a regular user, and then an IIS-hosted service would access the file under a different domain service account.Įvery time the service opened a connection, it took over 1.5 seconds, but otherwise operated correctly (it could eventually access the file). Having had the same problem, I was looking into this and it seems to be related to permissions on the file or it's parent folders, who created it, and/or how it was created. public SqLiteDatabase(String inputFile)ĭbConnection = String.Format("Data Source=ms", iterations, diffTime.TotalMilliseconds/iterations)) inputFile is just the string path of the filename to open. Sure, dbConnection is the connection string, set by the following function. Logging.LogDebug("SQLiteCommand executed reader!") Using (SQLiteDataReader reader = mycommand.ExecuteReader()) Logging.LogDebug("SQLiteCommand executing reader.") ![]() Logging.LogDebug("SQLiteCommand Created!") Using (SQLiteCommand mycommand = new SQLiteCommand(cnn)) Logging.LogDebug("SQLiteCommand Creating.") Logging.LogDebug("SQLiteConnection Opened!") Logging.LogDebug("SQLiteConnection Opening.") Logging.LogDebug("SQLiteConnection Created!") Using (SQLiteConnection cnn = new SQLiteConnection(dbConnection)) Logging.LogDebug("Creating SQLiteConnection.") public DataTable GetDataTable(string sql) I've considered using some form of connection pooling, but is it worthwhile to pursue that for a single-instance single-threaded application? Right now, I'm creating an instance of my SQLiteDatabase class, and calling the below function for each of my queries. I've tried repeating this, and cannot predict whether subsequent connections will open nearly immediately, or be delayed like this. 15:05:41,658 DEBUG - DataTable Loading.Īs you can see, in this instance it took 1.7 SECONDS to open the connection. 15:05:41,658 DEBUG - SQLiteCommand executed reader! 15:05:41,627 DEBUG - SQLiteCommand executing reader. 15:05:41,627 DEBUG - SQLiteCommand Created! 15:05:41,627 DEBUG - SQLiteCommand Creating. 15:05:41,627 DEBUG - SQLiteConnection Opened! 15:05:39,927 DEBUG - SQLiteConnection Opening. 15:05:39,927 DEBUG - SQLiteConnection Created! I've narrowed it down to the call to cnn.Open() as shown in the logs here: 15:05:39,864 DEBUG - Creating SQLiteConnection. Below is my code, with all the extra debugging statements I've added this afternoon. I've noticed that my small 224kB SQLite DB is very slow to open in my C# application, taking anywhere from some small number of ms, to 1.5 seconds or more. ![]() It remains to be seen if the benefits of changing the user account will persist, or if it will only be temporary. I changed both my service and test app to run as the SYSTEM account instead of the NetworkService account. I guess my issue is resolved for the moment.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |