1

Sometimes when i am running my installer (build with wix) it fails to install or start the service. But the problem doesn't always appear, so most of the time it works and but now and then it fails. My solutions until now are:

  1. Retrying by pressing the retry button.
  2. Retrying by closing the installer and opening it again.
  3. Retrying by closing the installer and the windows file explorer and the reopening both.
  4. Disconnecting external drive and the reconnecting it and retrying the installer.

But i am looking for how i can permanently solve it. Since i want to have a reliable installer.

The following devices are used:

  1. Windows tablet with Windows 8.1
  2. Windows tablet with Windows 10
  3. Windows pc with Windows 10
  4. VirtualBox instance with Windows Server 2016
  5. VMWare instance with Windows 7

Project specs:

  • .NET 4.7.1
  • Wix 3.11.1.2318
harm27
  • 41
  • 3
  • 10
  • How do you install the service? When it fails, what does the installation log show? – rs232 May 11 '18 at 13:38
  • The installer might fail if you have the "Services" window open while deleting and installing the Service. Other than that, I haven't had problems with WiX. – Koja May 11 '18 at 16:57
  • @Koja that might have been my problem. Don't see the error anymore. – harm27 May 15 '18 at 10:03
  • Be sure to try on a few test computers - just to state the obvious. Are you running the service as LocalSystem? – Stein Åsmul May 15 '18 at 15:14
  • Services and the Service Control Manager communicate with admins using the Windows Event Log. See what the Service Control Manager is saying about starting your service, then, if your service is actually getting a chance to start starting, it might have something to say about why it doesn't finish starting. – Tom Blodget May 15 '18 at 16:48
  • @Tom Blodget Great, you are here! :-). I haven't done service code in years. [What do you think of this - problems with threading and log4net](https://stackoverflow.com/questions/7009759/c-sharp-windows-service-timeout-on-startup#comment8370218_7009759)? Could the problem ironically be the logging itself? (my favorite kind of bugs: bugs in auto-update features, bugs in bug report features, and bugs in debugging features! Irony in practice! Real gotchas) – Stein Åsmul May 15 '18 at 19:29
  • @harm27 Do you use log4net? (typical of me to forget to ask). If not, how do you do logging? – Stein Åsmul May 15 '18 at 19:38
  • When the startup fails, how long does it take to fail? Does it timeout? – Stein Åsmul May 16 '18 at 00:36
  • "fails to install or start" vs "most of the time retrying fixes it": Does it always get installed, as in files and service created? – Tom Blodget May 17 '18 at 10:35

1 Answers1

0

Verbose, Debug Logging: Maybe try to do verbose logging with extra debugging information and direct write without buffering (to prevent loss of log buffer due to crashes - the latter not really needed for your case, but leave it in) and see if you get more information about the runtime error:

msiexec.exe /i C:\Path\Your.msi /L*vx! C:\Your.log


Some questions:

  • Are you running any custom actions related to the service installation?
  • What does your service actually do? Does it involve any database connections?
  • Does the error happen on specific machines only - or on all machines? Is the machine in question a virtual machine?
  • Is it accurate that retrying makes the service eventually start?
  • What language is the service written in? Managed code? (yes, looks like it is)
  • This service is not a binary automatically converted to run as a service, is it? (guess not)
  • What does it say in the event viewer? (Windows + R eventvwr and OK)
Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • No customactions used. No databases used. No the error appears now and then, and not always the same machine. Indeed, most of the time retrying fixes it. It is written in C#. It is not a converted service. EventViewer most of the time doesn't give the error cause. – harm27 May 15 '18 at 10:02
  • Maybe have a quick skim of [another answer I wrote recently on services](https://stackoverflow.com/a/50354019/129130). Maybe with particular focus on the security software issues? – Stein Åsmul May 15 '18 at 16:11