Web App as Windows Service and Sqlite

  1. 5 months ago

    Nicholas H

    is not verified Jan 2 Pre-Release Testers

    I have an app installed as a Service on a windows machine. It creates an sqlite database if it does not detect one in the Documents folder. I'm a bit confused however because i ran the app before i installed it as a service and it created a database in the user's Documents folder. When i look at the database with a regular third party db browser i can not see any data.

    Does running a web app as a service have a different "Documents folder" when run this way?

    I can not find any other copy of the database on the filesystem. Or am i just not able to see the data because the running web app has it locked?

  2. David C

    Jan 3 Pre-Release Testers, Xojo Pro Derby, ITM

    Service apps run as Admin, so it may be in a different user's Documents folder.

  3. Greg O

    Jan 3 Xojo Inc Somewhere near Raleigh, NC

    @David C Service apps run as Admin, so it may be in a different user's Documents folder.

    Sometimes they don’t even do that. If you’ve got it set up to run before anyone logs in, it could be one of the system level users like “NETWORK”.

    Try using something like SpecialFolder.SharedDocuments or SpecialFolder.SharedApplicationData.

  4. Nicholas H

    is not verified Jan 3 Pre-Release Testers

    @Greg OLone Sometimes they don’t even do that. If you’ve got it set up to run before anyone logs in, it could be one of the system level users like “NETWORK”.

    I have it running as a service whenever the user logs in. It is a local admin account. At this moment I can’t just change the location of the database as there is a good amount of data already being used so I need to find it so it can be backed up.

    I suppose I could move the database that I can see and if that it where it’s creating it then it should make a new database there. If it doesn’t I have no clue where I would look.

  5. Wayne G

    Jan 3 Pre-Release Testers New Zealand axisdirect.nz

    @Nicholas H I can’t just change the location of the database as there is a good amount of data already being used so I need to find it so it can be backed up.

    You won't be able to use specialfolder then. You'll need to use GetfolderItem("C:").Child("Users").Child("<username>").Child("Documents") etc. The service shouldn't have any issues with permissions.

  6. Nicholas H

    is not verified Jan 5 Pre-Release Testers

    C:\Windows\System32\config\systemprofile\Documents\

    This is where it ended up creating the database which is fine now that i know where it is. I just wrote a msgbox to tell me =x.

  7. 4 months ago

    Greg O

    Jan 7 Xojo Inc Somewhere near Raleigh, NC

    @Nicholas H C:\Windows\System32\config\systemprofile\Documents\

    This is where it ended up creating the database which is fine now that i know where it is. I just wrote a msgbox to tell me =x.

    That looks like the location files are copied from when a new account is created. You might want to check and make sure you don’t get a copy every time an account is created.

    I’d also bet that non-admin users can’t write to that location.

  8. Nicholas H

    is not verified Jan 8 Pre-Release Testers

    @Greg OLone That looks like the location files are copied from when a new account is created. You might want to check and make sure you don’t get a copy every time an account is created.

    I’d also bet that non-admin users can’t write to that location.

    There will only ever be the one user on this device that starts the service so I should be fine. The service app does all the reading and writing. Users use the web ui served and can read and write fine.

  9. Nicholas H

    is not verified Jan 12 Pre-Release Testers

    Ok so a windows update completely wiped that directory and it no longer exist nor will it let my app recreate that space which is pretty weird so I will have to change the location.

    The update also removed the service I created to run the app. Is this normal behavior?

  10. Louis D

    Jan 12 Pre-Release Testers, Xojo Pro Montreal, QC, Canada

    No. I had several Windows Updates applied to my Windows web server. The service that runs my webapp was never removed, nor any of the folders I created for the application, either manually or automatically by the application. Now, I created the application folders used by the app directly on the C drive. Not under any user document folder. I did the security to allow access only to the user that runs the application and the administrator. This is currently a Windows 8.1 VM. I will have to update it to 10 pretty soon.

    I would look elsewhere for a cause. Are there more than one administrators in that computer?

  11. Nicholas H

    is not verified Jan 12 Pre-Release Testers

    @LouisDesjardins I did the security to allow access only to the user that runs the application and the administrator. This is currently a Windows 8.1 VM. I will have to update it to 10 pretty soon.

    I would look elsewhere for a cause. Are there more than one administrators in that computer?

    There is only one administrator and I used this command as recommended by Xojo through the cmd line run as admin:

    sc create ServiceName type=own start=auto binpath=path
  12. Louis D

    Jan 12 Pre-Release Testers, Xojo Pro Montreal, QC, Canada

    The command is fine.

    The point is that I never saw an update remove a service, nor can we find anything to that effect on the net. The service was deleted, that is a fact. Given that it is improbable that an update did it, I was looking for some other more plausible explanation. That remains to be found.

    What else is running on that server?
    What automated maintenance tasks are configured on the server?

  13. Nicholas H

    is not verified Jan 13 Pre-Release Testers

    @LouisDesjardins The command is fine.

    The point is that I never saw an update remove a service, nor can we find anything to that effect on the net. The service was deleted, that is a fact. Given that it is improbable that an update did it, I was looking for some other more plausible explanation. That remains to be found.

    What else is running on that server?
    What automated maintenance tasks are configured on the server?

    I am the only admin that works on this computer. It is just a basic windows 10 installation not an actual server. There are no automated maintenance tasks and the user does not know how to remove a service.

    It was definitely caused by the update and working fine previous to the update.

    I will also note that this is also the second system I have found that does not allow palette windows to move around. I have a post about it but could never resolve that issue. Works fine on my development system but when run from this users system palette windows do not function properly. My Lenovo laptop is the other system that would not allow the window to move.

    I just have a knack for finding or creating weird bugs that no one else can duplicate on their systems even when I give them my source :-(.

  14. Louis D

    Jan 13 Pre-Release Testers, Xojo Pro Montreal, QC, Canada

    Interesting. So an update may be the cause after all. Was the update something like the installation of a new Windows 10 version? (like 1709, for example?) A new version may be a situation where services are removed, because we are basically starting with a fresh install, with applications migrated over. Own services may not be considered in the migration. I cannot see any other situation that could do this to a system. My own systems that were updated to newer versions of Windows 10 retained the folders that I created on the system. None has a own service however, so I don't have direct experience there. I am very interested and curious to find the conditions that would wipe folders and a service.

    I also own a Lenovo Laptop. A 4th gen Carbon X1. I have Xojo installed on it and it runs windows 10. This system is indeed whimsical. This is the only system ever that I was unable to upgrade the disk. Even a bit-for-bit copy won't boot (it does in safe mode however!).

or Sign Up to reply!