Hi,
I was doing update using win form application and it is working fine. But i do not want to show any UI window to user and also i do not want UAC prompt so as per your suggestion I tried to do auto update using window service.
I created window service and put below code into the Onstart event of service.
auBackend = new AutomaticUpdaterBackend(); auBackend.UpdateType = UpdateType.Automatic; auBackend.GUID = "48787287-5a45-4a53-ac28-3fc558931c9d"; auBackend.ReadyToBeInstalled += auBackend_ReadyToBeInstalled; auBackend.UpdateSuccessful += auBackend_UpdateSuccessful; auBackend.UpToDate += auBackend_UpToDate; auBackend.UpdateFailed += auBackend_UpdateFailed; auBackend.Arguments = "-quickcheck -justcheck -noerr"; auBackend.CheckingFailed += new FailHandler(auBackend_CheckingFailed); auBackend.ServiceName = this.ServiceName; auBackend.Initialize(); auBackend.AppLoaded();
if (!auBackend.ClosingForInstall) { // sees if you checked in the last 10 days, if not it rechecks CheckForUpdate();
//Note: Also, since this will be a service you should call // CheckEvery10Days() from an another thread (rather // than just at startup)
//TODO: do your normal service work } timer.Interval = 20 * 60 * 1000; timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed); timer.Start();
My timer will check updates after every 20 minutes.
Now when updates founds, before installing new updates, I am killing running applications. But after that my window service stops running and update does not happen.
Can you please help what i am doing wrong