Service updater not re-starting after update

We are attempting to move to a service based updater, in order to update our application under program files without forcing a user to approve elevated privileges each time.

The service runs, checks for updates, and applies the update. But the service does not re-start. I believe it should automatically re-start (like the app used to). However, I even added an update action to start the service after update. It still does not re-start.

I've checked and re-checked the naming of everything per other posts, but everything looks right. Any ideas?

Figured it might help to share some of my code.

Inside the service OnStart, I have the following snippet -

_updater = new AutomaticUpdaterBackend{ GUID = "<myguidhere>", UpdateType = UpdateType.Automatic, wyUpdateLocation = Path.Combine(progFolder, "wyUpdate.exe"), wyUpdateCommandline = " /fromservice", ServiceName = this.ServiceName};_updater.ReadyToBeInstalled += Updater_ReadyToBeInstalled;

if (_updater.UpdateStepOn == UpdateStepOn.Nothing){ _updater.ForceCheckForUpdate();}

And the supporting code -private static void Updater_ReadyToBeInstalled(object sender, EventArgs e){ if (_updater.UpdateStepOn == UpdateStepOn.UpdateReadyToInstall) { StopApp(); _updater.InstallNow(); }}

static void StopApp(){ var args = @"/im MyApp.exe /f /t";

var psi = new ProcessStartInfo("taskkill", args); psi.Verb = "runas"; psi.CreateNoWindow = true; psi.WindowStyle = ProcessWindowStyle.Hidden; psi.UseShellExecute = true;

var process = Process.Start(psi); if (process != null) process.WaitForExit();}

Sorry, thought of one more pertinent detail. After the update, wyupdate does launch the application itself, according to the setting "execute file after updating is complete". It's just the service that doesn't start. If the AutomaticUpdaterBackend didn't auto-restart it, I figured manually setting it to start in the Update Actions would have done the trick. No dice either way.

So I unchecked "execute file after updating is complete" on my program executable and now the service restarts after the update just fine. The only problem is now my app isn't running after the update. And there's no easy way to relaunch it as the logged in user from my updater service since it runs as Local System.

Any suggestions on how to fix this or insights into why executing the program from the updater is screwing up the service restart?

Any suggestions on how to fix this or insights into why executing the program from the updater is screwing up the service restart?

I don't know. You need to provide. logs and tell me what you're checking as part of the update (for example -- are you checking "Wait for app to finish"? -- because that does just what it sound like -- your app will start wyUpdate will continue to wait forever and never finish the update process).

Also, if you want to launch your app you would have to do it from your Window Service. Or just run wyUpdate from the user-level. Those are currently the only 2 choices.

Great question. I had "Wait for execution to finish" and "Rollback update on non-zero" both checked. Unchecking "Wait for execution to finish" cleared things up. I guess waiting caused a timing issue?

Nevermind, I was thinking about it all wrong. wyUpdate is looking for the executable to "finish" whereas I was thinking in my head "successful start." Thanks for your help!