Forum Discussion
Service Msix Automatic Update
JDHIntercede Thanks for the reply, this seems to be a way forward. however im running into problems running my app using the appinstaller....
If i install it from the bundle file, the service runs correctly.
If i install from the appinstaller while having the URI pointing to local folder or azure, the installation happens however it service doesnt run. I get this error:
Exception Info: Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 14: 'unable to open database file'.
at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
This tells me the permissions after installing have somehow changed comparing to previous install method. Everything is installed, however this fails
optionsBuilder.UseSqlite($"Filename={Path.Combine(runningPath, "MyDatabase.db")}");
Also if i unistall the app, installed with appinstaller, then it unistalls but the service is still show in services control panel... Only after restarting the machine it disappears.
Thank you again
<UpdateSettings>
<OnLaunch HoursBetweenUpdateChecks="24" />
<AutomaticBackgroundTask />
</UpdateSettings>
I have this, and i was expecting that by stoping the service and starting it again it would trigger the upgrade? Or the only real time this kicks in is if we restart the windows machine? Since this is a Windows Service?
- jocsJul 15, 2022Copper Contributor
JDHIntercede restarting the machine also doesnt seem to make any updates happen... i can download the updated app installer and if i download it and run it asks to update so it looks ok from the appinstaller side... Is this not working because this msix app is a windows service?
- JDHIntercedeJul 15, 2022Brass Contributor
The config you have here means that it will only check for updates on launch once in a 24hr period, and if it has just been installed then I suspect it's not going to look until 24hrs after that (although that's just a guess). Try removing the HoursBetweenUpdateChecks to enforce a check on every launch. It's also worth checking the features you're trying to use are supported on your version of Windows.
All this being said, if the permissions issue you mention earlier is because AppInstaller isn't elevating correctly then you may run into the same issue when it installs an update.- jocsJul 18, 2022Copper Contributor
@JDHIntercede the appinstaller brings a request for admin, and i can see the service running under SYSTEM account so it should have the correct execution permissions. Ive removed the HoursBetweenUpdateChecks but still the same result... I think this is really what is expected from this scenario, but would be good to confirm...
Windows Services are really something that existed earlier to msix, recently they have introduce service deployment over msix but that im pretty sure simply runs a few sc create commands... Checking for updates is something that doesnt exist on launch windows service as for example running apps from msix, my service starts an exe and that exe definitely doesn't have logic to check for updates. Would be nice to confirm, in fact would be nice to confirm if this is at all supported by msix system since system services are quite new. My box should support it, its fairly recent 21H2 (added in 20H1)
Regarding the appinstaller permissions errors, i can only think of a bug with the appinstaller or a bug with msxbundle since they definitely have different behaviours.
ive made a sample in attachment
applicationdbcontext.cs should blow up when trying to create a db file in running path
optionsBuilder.UseSqlite($"Filename={Path.Combine(runningPath, "MyDatabase.db")}");
with msibundle it should work...
once it installs, then you will notice the service doesnt boot and in event log you will see the error im talking about.
thanks again for the help
- JDHIntercedeJul 20, 2022Brass ContributorIt sounds like this might need escalating to Microsoft - unfortunately this is a community forum and I am not a Microsoft employee, so I don't really have the information you're looking for. It does sound to me like this isn't working as advertised though, but whether that's a bug or by design is not something I could answer. Sorry!