First time with Windows Service AutomaticUpdater

Hi, I'm pretty sure I'm 95% there, but my Windows Service isn't automatically updating. First off, I need to upload my update files via FTPS. So I do that manually. Here's what I'm doing...

(1) I implemented the code changes to my service:

auBackend = New AutomaticUpdaterBackend() With { .GUID = "My Local Services", .UpdateType = UpdateType.Automatic, .ServiceName = Me.ServiceName } AddHandler auBackend.ReadyToBeInstalled, AddressOf auBackend_ReadyToBeInstalled auBackend.Initialize() auBackend.AppLoaded()

If Not auBackend.ClosingForInstall Then CheckNewVersion(180) End If

...later...

' -- I made it every 3 hours while I'm debugging... Private Shared Sub CheckNewVersion(ByVal Minutes As Integer) If (DateTime.Now - auBackend.LastCheckDate).TotalMinutes > Minutes AndAlso auBackend.UpdateStepOn = UpdateStepOn.[Nothing] Then auBackend.ForceCheckForUpdate() End If End Sub

Private Shared Sub auBackend_ReadyToBeInstalled(sender As Object, e As EventArgs) If auBackend.UpdateStepOn = UpdateStepOn.UpdateReadyToInstall Then auBackend.InstallNow() End If End Sub

(2) Created a project in WyBuild:

Update Information - set version to 2.1.1.76 (original was 2.1.1.75) Download site = http://service.mysuperapp.com/software/services/%file% Build wyUpdate & Updates = I click both buttons...should I? 🙂 Then I manually upload the files created: a) mysuperservice.all.to.2.1.1.75.wyu b) mysuperservice.all.to.2.1.1.76.wyu c) wyserver.wys To the FTPS server place that corresponds to the Download site below.

I've put some debug logging into the service and it runs CheckNewVersion(..), but it never gets into Backend_ReadyToBeInstalled(..) which to me seems like it's not detecting the newly published version.

Any suggestions? Thanks so much (in advance)!

There's not quite enough information to know exactly what's going on. A way to help you debug is to handle allevents, specifically CheckingFailed, UpToDate, and UpdateAvailable.

Also, what happens when you double click wyUpdate.exe? Does it say you have updates available?

Hi Thanks for the reply Sam.

I'll do that on the events to see what else is going on.

I'm not sure why I would run wyUpdate.exe - help me there. I'm doing a silent upgrade, so how does that .exe fit into the equation?

Thanks again and I'll also report back tomorrow on my event handler outputs.

I'm not sure why I would run wyUpdate.exe - help me there. I'm doing a silent upgrade, so how does that .exe fit into the equation?

Just to see if you have updates. I'm not saying you should programmatically call it. You should just double click it to quickly see if everything is set up correctly and you actually have an update pending.

Thank you Sam. When I run wyUpdate.exe it tells me that my app is up-to-date. This means to me, if I am correct, that I am not updating something necessary on the server. Since I must publish via FTPS, I wonder if I am missing sending a file?

Have you uploaded the *.wyu files and *.wys file? A good way to see what you need to upload (if you're not using wyBuild's built in uploader) is to open the folder that the files are built to, then rearrange the files by the date modified. Upload all the new files.

Hi Sam - yes that part I verified (and made sure that the MIME types were mapped so that IIS would serve them up). Your advice is paying off, on putting code in the various events, although I don't understand why the error is occurring. Here is the error message in CheckingFailed.

Event: CheckingFailed. Error: wyUpdate exited prematurely / The wyUpdate executable was not found: C:\Program Files\HotSoftware\LocalServices\wyUpdate.exe

It makes sense that it wouldn't find this exe - I'm not bundling it with the application/installer anywhere. Should I be?

Should I be?

Yes.

I think I successfully added it to the installer - getting closer!

It seems to be detecting a new version now. After calling ForceCheckForUpdate() I don't see it doing anything else.

I found that I'm not bundling all the right files into the installer. More in a bit.

After calling ForceCheckForUpdate() I don't see it doing anything else.

What's the return code for that function (true means it has begun checking, false means it hasn't). Are you handling all the events? What's the UpdateStepOn value?

I retraced my steps from this page: http://wyday.com/wybuild/help/walkthrough.php

Running wyUpdate.exe tells me that I've got a new version (original was 2.1.1.79, new one is 2.1.1.80).

Step 6 from the walkthrough ("Add your first version files") may be where I'm slipping up. It's not clear (to me) which files to include. The output of my service's build (bin\debug\*.*) perhaps?

The service is detecting a new version, but its UpdateStepOn seems to be stuck on DownloadingUpdate. That tells me that something is failing in the background, but I don't know what it is.

I verified that it's running as LocalSystem.

Step 6 from the walkthrough ("Add your first version files") may be where I'm slipping up. It's not clear (to me) which files to include. The output of my service's build (bin\debug\*.*) perhaps?

You include everything that consists of your old version. Put it in its own folder, then add those files to wyBuild. wyBuild does the hard work of comparing your versions.

The service is detecting a new version, but its UpdateStepOn seems to be stuck on DownloadingUpdate. That tells me that something is failing in the background, but I don't know what it is.

Handle all of the error events and log any errors.

[post deleted]

, edited

I tried including the build outputs of the service - and I think it works...almost. I notice that it is stuck on UpdateStepOn = UpdateReadyToInstall

When it is in this step, do I need to force the upgrade myself, or will it do that?

Sorry for the spam. I wanted to also post what I'm seeing in my logs from the various events (I catch all events):

8/27/2012 11:27 AM|Started Service (x.x.x.91)|0|0|8/27/2012 11:27 AM|Event: UpdateStepMismatch: System.EventArgs|0|0|8/27/2012 11:27 AM|Event: CloseAppNow: System.EventArgs|0|0|8/27/2012 11:27 AM|Event: CloseAppNow: System.EventArgs|0|0|EDIT: [service crashed, manually restarted]8/27/2012 11:35 AM|Started Service (x.x.x.91)|0|0|8/27/2012 11:35 AM|Event: UpdateFailed: The update failed to install. / 1 processes are running:~~ (LogiLocalService.exe)~|0|0|8/27/2012 11:35 AM|Checking for new version...|0|0|8/27/2012 11:35 AM|Event: BeforeChecking: wyDay.Controls.BeforeArgs|0|0|8/27/2012 11:35 AM| ForceCheckForUpdate(true) = true|0|0|8/27/2012 11:35 AM|Event: ProgressChanged: 100|0|0|8/27/2012 11:35 AM|Event: BeforeDownloading: wyDay.Controls.BeforeArgs|0|0|8/27/2012 11:35 AM|Event: ProgressChanged: 0|0|0|8/27/2012 11:35 AM|Event: ProgressChanged: 28|0|0|8/27/2012 11:35 AM|Event: ProgressChanged: 52|0|0|8/27/2012 11:35 AM|Event: ProgressChanged: 82|0|0|8/27/2012 11:35 AM|Event: ProgressChanged: 84|0|0|8/27/2012 11:35 AM|Event: ProgressChanged: 100|0|0|8/27/2012 11:35 AM|Event: ProgressChanged: 0|0|0|8/27/2012 11:35 AM|Event: ProgressChanged: 0|0|0|8/27/2012 11:35 AM|Event: ProgressChanged: 20|0|0|8/27/2012 11:35 AM|Event: ProgressChanged: 40|0|0|8/27/2012 11:35 AM|Event: ProgressChanged: 60|0|0|8/27/2012 11:35 AM|Event: ProgressChanged: 80|0|0|8/27/2012 11:35 AM|Event: ReadyToBeInsalled: System.EventArgs|0|0|8/27/2012 11:35 AM|Found new version...2.1.1.92|0|0|8/27/2012 11:35 AM|Event: CloseAppNow: System.EventArgs|0|0|8/27/2012 11:35 AM|Event: UpdateStepMismatch: System.EventArgs|0|0|8/27/2012 11:35 AM|Event: UpdateStepMismatch: System.EventArgs|0|0|8/27/2012 11:35 AM|Event: CloseAppNow: System.EventArgs|0|0|8/27/2012 11:35 AM|Last Version Check Date = 8/27/2012 11:35 AM|0|0|8/27/2012 11:35 AM| UpdateStepOn = UpdateReadyToInstall|0|0|8/27/2012 11:37 AM|Last Version Check Date = 8/27/2012 11:35 AM|0|0|8/27/2012 11:37 AM| UpdateStepOn = UpdateReadyToInstall|0|0|8/27/2012 11:39 AM|Last Version Check Date = 8/27/2012 11:35 AM|0|0|8/27/2012 11:39 AM| UpdateStepOn = UpdateReadyToInstall|0|0|8/27/2012 11:41 AM|Last Version Check Date = 8/27/2012 11:35 AM|0|0|8/27/2012 11:41 AM| UpdateStepOn = UpdateReadyToInstall|0|0|

On UpdateReadyToBeInstalled call InstallNow().

Ok thanks will try that.

I added the call to InstallNow().

Looking at the log, I now see this. I removed the intermediate ProgressChanged values. I currently check the UpdateStepOn every two minutes.

Run 2.1.1.93Latest published version is 2.1.1.94.

8/27/2012 1:02 PM|Started Service (x.x.x.92)|0|0|8/27/2012 1:02 PM|Event: UpdateFailed: The update failed to install. / Cannot open Logi Local Services service on computer '.'.|0|0|8/27/2012 1:02 PM|Checking for new version...|0|0|8/27/2012 1:02 PM|Event: BeforeChecking: wyDay.Controls.BeforeArgs|0|0|8/27/2012 1:02 PM| ForceCheckForUpdate(true) = true|0|0|8/27/2012 1:02 PM|Event: ProgressChanged: 100|0|0|8/27/2012 1:02 PM|Event: BeforeDownloading: wyDay.Controls.BeforeArgs|0|0|8/27/2012 1:02 PM|Event: ProgressChanged: 0|0|0|...8/27/2012 1:02 PM|Event: ProgressChanged: 99|0|0|8/27/2012 1:02 PM|Event: ProgressChanged: 100|0|0|8/27/2012 1:02 PM|Event: ProgressChanged: 0|0|0|...8/27/2012 1:02 PM|Event: ProgressChanged: 96|0|0|8/27/2012 1:02 PM|Event: ReadyToBeInsalled: System.EventArgs|0|0|8/27/2012 1:02 PM|Found new version...2.1.1.94|0|0|8/27/2012 1:02 PM|Event: CloseAppNow: System.EventArgs|0|0|8/27/2012 1:02 PM|Event: CloseAppNow: System.EventArgs|0|0|8/27/2012 1:04 PM|Event: CloseAppNow: System.EventArgs|0|0|8/27/2012 1:06 PM|Event: CloseAppNow: System.EventArgs|0|0|

, edited

If you handle the CloseAppNow event then you actually have to shut down your service. We recommend not handling that event unless you want to ahndle your own shutdown method. Just let the AutomaticUpdater handle it. We mention this in the AutomaticUpdater members help article.

EDIT: It upgraded successfully once. I tried publishing another, and it has broken down. The service stopped, and worse, when I go to restart it in services.msc, it says "Could not start Logi Local Service on local computer" with additional message "Error 2: The system cannot find the file specified." So it seems like it did a partial run but something failed and now the service link to the executable is broken. It can't be fixed without a full .msi install, I believe.

8/27/2012 1:55 PM|Last Version Check Date = 8/27/2012 1:47 PM|0|0|8/27/2012 1:55 PM| UpdateStepOn = Nothing|0|0|8/27/2012 1:57 PM|Checking for new version...|0|0|8/27/2012 1:57 PM|Event: BeforeChecking: wyDay.Controls.BeforeArgs|0|0|8/27/2012 1:57 PM| ForceCheckForUpdate(true) = true|0|0|8/27/2012 1:57 PM|Retrieving commands...|0|0|8/27/2012 1:57 PM|Event: ProgressChanged: 100|0|0|8/27/2012 1:57 PM|Event: BeforeDownloading: wyDay.Controls.BeforeArgs|0|0|8/27/2012 1:57 PM|Event: ProgressChanged: 0|0|0|8/27/2012 1:57 PM|Event: ProgressChanged: 100|0|0|8/27/2012 1:57 PM|Event: ProgressChanged: 0|0|0|8/27/2012 1:57 PM|Event: ReadyToBeInsalled: System.EventArgs|0|0|8/27/2012 1:57 PM|Found new version...2.1.1.97|0|0|[end of log]

, edited

It's our pleasure. I'm glad you got it to work.

In the meantime, I tried to uninstall and then reinstall my service via the .msi. It won't even let me do that! Yikes.

Error message:

"Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel."

However, it's not there because I uninstalled it.

Could I just pay extra for consulting support to implement this? This scares me a bit about including it with my product if it could do this on a client's PC. It would create a support nightmare. 😲

Hi Wyatt - unfortunately I needed to edit my success post 🙁 Can you help? I'm happy to pay extra for the consulting time (phone, GotoAssist, whatever) as I must have a serious disconnect.

I think you're messing up the step where you add the files to your wyBuild project file. You need to copy all the files in every version of your app to its own folder. (And by files I mean the binary files that will be released to your users and consist of "your product").

You name the folders like 1.1, 1.2, etc.

Then drag & drop from these folders into wyBuild.

Does that make sense? This is covered in the step-by-step walkthrough. Please don't skip any steps (they're all important).

If you need more help we can schedule a time to talk.

It's definitely possible. I have followed those step by step instructions, but the note that says to copy all files doesn't say whether it's the source code, the output folder (\bin\release or \bin\debug), or the installer's output folder, etc.

So for now, I'm taking the entire contents of the \bin\debug folder (for my service project, not the installer project) for putting into the wyBuild project file.

I have a new folder for each instance. Then I drag all files from the version-named folder into the Your Programs Folder folder in wyBuild and create the wyUpdate and Update from there. I manually upload the files to my server as it requires FTPS.

Here is the entire file list in my 2.1.1.97 as an example. Should I only be adding a subset of these files?

AlexPilotti.FTPS.Client.dllAutomaticUpdater.dllAutomaticUpdater.xmlclient.wycInstallUtil.InstallLogjonesposbackupservice.InstallStateJonesUtilities.dllLogixPOSLocalService.exeLogixPOSLocalService.exe.configLogixPOSLocalService.pdbLogixPOSLocalService.vshost.exeLogixPOSLocalService.vshost.exe.configLogixPOSLocalService.vshost.exe.manifestLogixPOSLocalService.xmlLogixPOSLocalService.XmlSerializers.dllZipForge.dll

It's definitely possible. I have followed those step by step instructions, but the note that says to copy all files doesn't say whether it's the source code, the output folder (\bin\release or \bin\debug), or the installer's output folder, etc.

We don't say it explicitly, but it's implied that you include the files that you'll be releasing to your customers. Your your product consists of just YourApp.exe then that's what you copy to its own version folder on your harddrive. And then from that new version folder, add the file to wyBuild.