Windows Service fail to update on Windows 2012

I've implemented wyUpdate / AutomaticUpdater in a .NET windows service and its been tested and proved to work in a handful of environments. However, all is not peaches and cream. Yesterday the service was installed in a new environment and it failed to update itself and even worse - it failed to restart it self.

The environment is Windows 2012, Datacenter Server, 64 bit.The log from the windows service shows 2 scenarioes. First the services receives ReadyToBeInstalled-callback from AutomaticUpdateBackend and the applicationDomain receives ProcessExit event, which is the last log-entry.Other scenarios detects that AutomaticUpdateBackend.ClosingForInstall=true and then receives ProcessExit event.

After either scenario, inspection of the service shows it's no longer running and no files has been updated. There's nothing in the Event Viewer showing abnormalities, in fact, Windows Logs -> System shows a log entry, that says the windows service "terminated unexpectedly. It has done this 17 time(s)". I guess this is wyUpdate, killing the process? I've made sure, that the windows service under no circumstances stops itself.

The windows service logs on as LocalSystem account, and it's been tried to run it as the same AD user which is used to log onto the server. If the AD user stops the service, execute wyUpdate.exe, the service updates itself correctly.

Do you have any suggestions what to do next? Is there a way to enable logging of the wyUpdate module to inspect what's going on?

If you're using wyUpdate as a standalone updater, then you should never close the service -- let wyUpdate do it.

If you're using the AutomaticUpdaterBackend, then you need to make sure you use the CloseAppNow event, and cleanly close your service (or else the AutomaticUpdater will just kill your service, which may or may not work).

Starting with the error messages from the AutomaticUpdater events. And the many options from wyUpdate commandline: http://wyday.com/wybuild/help/wyupdate-commandline.php

I was unaware of the CloseAppNow event as it isn't mentioned in the tutorial for implementing the AutomaticUpdaterBackendat http://wyday.com/wybuild/help/automatic-updates/windows-services-console-apps.php

I've changed the windows service, so it now stops itself when it receives the CloseAppNow event. The system event log no longer shows the error message saying the process "terminated unexpectedly". However, the problem persists. None of the "Failure" event fires and the windows services receives event that an update is ready to be installed and shuts itself down properly. Nothing else happens. The service fails to update and fails to restart itself.

I've tried to use commandline options to enable logging to get a clue about what's going on, but the auBackend seems to ignore the arguments. I've tried the following arguments:/fromservice -logfile="c:\wyLog.txt"/fromservice -logfile="Log.txt"-logfile="c:\wyLog.txt"-logfile="Log.txt"

None produce any log files.

I've verified, that the service is in fact running as the Local System System account.

The windows service is able to automaticly update itself on other systems. For instance, its been tried on an in-house windows 2012 server, and it works fine. But on our customer's Windows 2012 server, it fails. The windows service updates without problems on our customer's server, if you manually run wyUpdate.exe. Do you have any other suggestions, how to diagnose the problem?

There might be something on the customer's machine that's killing the process. I would monitor the process. Or, a last case scenario is attach a debugger to wyUpdate and to see at which point the customer's system is killing the process.

If you could reproduce this, that would be helpful.

I have encountered the same problem.with version:

The case is: I am new to Wybuild and

When I deployed the project by 1. add a new version2. attach 2 .bat files to Temporary folder3. fill in Command line switches and ticking "Execute file..."4. Generate Client.wyc5. upload to the git repository and build a .msi file with that client.wyc in the project6. attach the .msi file back to Temporary folder7. Build Updates8. Upload the Updates

And in the 3, I forgot to tick "Execute", and now, 1. the update fails2. cannot restart the Auto-update service on clients' computer even I reinstall the auto update service

Forgot to write,

My Wybuild version is 2.6.18.4and same as SimonBen, I have found that the ClosingForInstall flag has been set to true.

Whenever I want to start the service, it states:Windows could not start the "ServiceName" service on local computerError: 1067: The process terminated unexpectedly.

And before more people are affected by the issue (version A), I released another version with step 3 properly implemented (version B), and now,

The users who had not started the update for version A has no issue installing version B.However, users who tried to install version A still have this issue.

I do think there is a bug in Wybuild, 'cause the autoupdater mainly call wybuild functions.

More information needed. Exceptions. Error codes. Code you're using.

Honestly, just avoid the AutomaticUpdater component altogether. It's too easy to misuse (99.99% of problems people have is misusing this component).

Just use wyUpdate: https://wyday.com/wybuild/help/silent-update-windows-service.php

Okay, I have done tests for several days now...and I have downloaded the source code and debugged it

My code is rather simple, just to:1. _auBackend = new AutomaticUpdaterBackend { GUID = "some_GUID", UpdateType = UpdateType.Automatic};

2. get Client.wyc Location, and _auBackend.wyUpdateCommandline = string.Format("-cdata=\"{0}\"", _clientWycLocation);

3._auBackend.ServiceName = "EdgeAddinAutoUpdater"; (equals to the windows server name declared)

4.handle all _auBackend events (mostly logging), except: auBackend_ReadyToBeInstalled will call _auBackend.InstallNow();

5. call _auBackend.Initialize(), _auBackend.AppLoaded();

6. if (!_auBackend.ClosingForInstall){ _workingThread = new Thread(new ThreadStart(workingThread)); _workingThread.Start(); }

where the workingThread fires ForceCheckForUpdate if UpdateStep is not DownloadingUpdate, Checking and ExtractingUpdate. And it does once every 15 mins so that our clients can update anytime.

That is pretty much all the logic we have. And then, only the clients received "corrupted update" files have issue (i.e. the 3rd Step missed). If a client starts the update after we re-publish the files with proper setting, it works fine.

Thus, I think it is not about the issue in our code...

And then, first, I have found that C:\Windows\System32\config\systemprofile\AppData\Roaming\wyUpdate AUhave "some_GUID.autoupdate" and it records the UpdateStepOn, thats why ClosingForInstall is set to true because the updateStepOn is marked to be UpdateReadyToInstall and the service terminated unexpectly after it is started, so... it is forever UpdateReadyToInstall.

It super strange that even we delete the service and re-install, it still cannot be started... mind if you suggest any temp files stored in my clients' computer? (we have tried Roaming\wyUpdate AU)

Don't use the AutomaticUpdater. We've designed it so that it's too hard to be used correctly. We're dropping support for it in the next version.

Just use wyUpdate directly: https://wyday.com/wybuild/help/silent-update-windows-service.php

Thanks Wyatt,I have used WyUpdate.exe and it is working fine.

Only, (we are using C#) in checking update:

Process checkProcess = Process.Start(startInfo);checkProcess .WaitForExit();if (checkProcess .ExitCode == 0)Logger.LogInfo("The app is up to date");

But ExitCode == 0 can also mean more than 1 things right?I have encountered the case that WyUpdate.exe has more than 1 instances running in the computer (can tell from Task Manager) will also result in ExitCode == 0.

Is it possible make a code, like exitCode 3 to unquiely indicate the app is up to date or use the new code to indicate if some exceptions have occured? because I do need to accurately report whats wrong to the users...