Hi,
I have a problem with wyUpdate updating a window service. I use this link to do the update: http://wyday.com/wybuild/help/silent-update-windows-service.phpAnd also this : http://wyday.com/wybuild/help/services.php
But it doesnt work properly. The service is updated, but in the OnStart event the auBackend.CloseForInstall is still true, so my code to open my service host is not executed.
And more to that, when I check in the event viewer I dont see any stop event, only a start event. So I wonder if my update action is working properly.
Heres a sample of my code:
/// <summary>/// Initializes the automatic updater./// </summary>private void InitializeAutomaticUpdater(){_automaticUpdaterBackend = new AutomaticUpdaterBackend();_automaticUpdaterBackend.GUID = "some guid";// With UpdateType set to Automatic, you're still in// charge of checking for updates, but the// AutomaticUpdaterBackend continues with the// downloading and extracting automatically._automaticUpdaterBackend.UpdateType = UpdateType.Automatic;// We set the service name that will be used by wyUpdate// to restart this service on update success or failure._automaticUpdaterBackend.ServiceName = ServiceName;
_automaticUpdaterBackend.wyUpdateCommandline = "/fromservice -server=\"" + UpdatePath + "/wyserver.wys\" -updatepath=\"" + UpdatePath + "\"";
_automaticUpdaterBackend.UpdateFailed += AutomaticUpdaterUpdateFailed;_automaticUpdaterBackend.CheckingFailed += AutomaticUpdaterCheckingFailed;_automaticUpdaterBackend.ReadyToBeInstalled += AutomaticUpdaterReadyToBeInstalled;_automaticUpdaterBackend.DownloadingFailed += AutomaticUpdaterDownloadingFailed;_automaticUpdaterBackend.ExtractingFailed += AutomaticUpdaterExtractingFailed;
// Initialize() and AppLoaded() must be called after events have been set.// Note: If there's a pending update to be installed, wyUpdate will be// started, then it will talk back and say "ready to install,// you can close now" at which point your app will be closed._automaticUpdaterBackend.Initialize();_automaticUpdaterBackend.AppLoaded();}
/// <summary>/// Starts the host./// </summary>/// <param name="args"></param>protected override void OnStart(string[] args){InitializeAutomaticUpdater();
if (!_automaticUpdaterBackend.ClosingForInstall){CheckForUpdate();OpenHost();}}
/// <summary>/// Stops the host./// </summary>protected override void OnStop(){CloseHost();}
/// <summary>/// Performs the wyBuild update./// </summary>/// <param name="sender">Sender</param>/// <param name="args">Event arguments</param>private static void AutomaticUpdaterReadyToBeInstalled(object sender, EventArgs args){if (_automaticUpdaterBackend.UpdateStepOn == UpdateStepOn.UpdateReadyToInstall){CloseHost();_automaticUpdaterBackend.InstallNow();}}
/// <summary>/// Checks for update./// </summary>private static void CheckForUpdate(){if (_automaticUpdaterBackend != null && _automaticUpdaterBackend.UpdateStepOn != UpdateStepOn.DownloadingUpdate&& _automaticUpdaterBackend.UpdateStepOn != UpdateStepOn.Checking){_automaticUpdaterBackend.ForceCheckForUpdate();}}
Because of this, when my service is updated, when I call it from my application I get an endpoint error.
wyUpdate version : 2.6.14