At Your Service - Installing Windows Service with WiX v4
ฝัง
- เผยแพร่เมื่อ 11 ก.ย. 2024
- Episode 25 of the Deployment Dojo
A weekly show hosted by Rob Mensching, walking through the basics of software deployment and the WiX Toolset.
You can get answers to your questions from Rob, sign up at FireGiant: www.firegiant....
Thanks for the valuable content Rob. It helps a lot. Cheers.. :)
Hi, thanks for the content. I've followed the tutorial until the end of the video. But I can't figure it out about the.cmd file. Can you explain how to make the.cmd file? Thank you
The Deployment Dojo shows are serial. That means they are designed to be watched from the beginning. If you jump into the middle of the series you may be missing some very important steps. Go back and watch a few more episodes. Everything is done live so you will see it happen before your very eyes. :)
Hi. I am get the following error
"failed to start service
Make sure you have Sufficient Priviledges to start system services"
what could be the reason for this
Also in installer log I cannotfind "serviceInstall"
In this episode or one of the next, I hit a problem while installing and show how to diagnose this very issue. Watch closely and you can learn how I tackle this problem.
Hello! were you able to solve this? I'm getting the same issue
Hi Rob, at the very beginning of this stream you mentioned that everyone wants to create Windows Services but nobody probably should and hopefully our applications don't have them. I know this isn't directly related to WiX v4, but I'm curious to know what makes you say this. What would you suggest as an alternative to a Windows Service in cases where a developer wants to run an unattended program in the background on a user's system? Thanks!
First, this is a gross oversimplification and may not apply to your situation (but it might... 😁).
I find developers are drawn to Windows Services the way they are drawn to Custom Actions. They are both cool places to write code with lots of power. And we all know, as Uncle Ben says, "With great power comes great responsibility." So, you need to respect the power, and you need to know you need it, and you need to know you tried everything to not need to have it. Basically, it's the plot of a superhero movie. No surprise developers are drawn to Windows Services and Custom Actions.
Windows Services have two possible superpowers. They can start when the OS starts, and they can execute as the OS. Being able to execute as the OS is a pretty obvious superpower. You should only choose that option if you _absolutely_ must. In fact, I probably did a disservice in this video by not calling that out. The counting service I created in this video has no business running with the power it has. I should fix that in a future episode. 🤔
Which leaves us with the "running all the time" superpower. At first glance, this superpower may seem useful without real downsides. The problem is the service consumes CPU cycles, memory, and electrical power from the user's device. You better be providing a really important value to tax the user's device 24x7x365.25.*
One of the important "services" (🥁) I provide when consulting with a client of FireGiant, is drilling into requirements to find fundamental truths. Sometimes it is fundamentally true that the solution requires complete access to the user's computer all the time. But I do explore all options before resigning to a Windows Service.
What are those other options? Let your app start the background task when the user starts your app. Consider the user RunKey knowing that advanced users often stop those (because they don't want the code running all the time 🤣). Consider the task scheduler with all the options it has to start/stop processes in the background.
I really should address this topic in a future episode. Thanks for bringing it up, @cschmidty682.
@@meschine thank you for the very detailed response! This all makes sense now.
I am having trouble in installing the windows service. I am new to wix. I am getting below error while installing. Path: C:\Program Files\TODO Manufacturer Setup3.Installer\WixLearning.exe
Message: The application to execute does not exist: 'C:\Program Files\TODO Manufacturer Setup3.Installer\WixLearning.dll'. Anything with the path it has to do. How does it copy the whole publish directory? Do we need to HeatDirectory to copy the whole files to the directory? I don't see any other files than WixLearning.exe
This sounds exactly like a topic I plan to cover very, very soon.
Hi Rob, I'm trying to learn more about Windows Services in details. Especially about the Recovery part of 'First Failure' and 'Second Failure'. How can I set these values. I can't seem to find the documentation about it
I think you are looking for the ServiceConfigFailureActions element (wixtoolset.org/docs/schema/wxs/serviceconfigfailureactions/).
Hi thanks for video. Curious why the hate on services. A "windowless app" seems hacky imo. also would be cool if you do these videos without such tight coupling to visual studio. Showcasing your tool from the CLI would have the best reach. For example if I'm making a flutter app and do not use visual studio, yet I still need an installer. Is this tool appropriate for me? im not sure - because this tool seems to use visual studio.
You need to watch the first few episodes of the Dojo. Visual Studio isn't introduced for several episodes. When I finally do introduce Visual Studio, we've explored its benefits and motivated its continued use. But, I still drop back to just command line options to show how it can all be done without MSBuild and Visual Studio.
I also explained in this episode or the beginning of the next why services should be avoided unless necessary. There are technical reasons when to use a service.
Hi, source code, please...
You can see the GitHub repo available at the end of most episodes and the homepage for deploymentdojo.com has a link to GitHub as well.