Upgrading a Windows service unattended - windows

I have a Windows service app in C# and a setup project for installing the service. In the setup project, RemovePreviousVersion is set to true, and the custom actions are all set.
I upgrade the app by running the msi file which will have a higher version number than the installed version. While running the msi, I get a prompt saying the file is in use and asking me to Try Again, Continue or Exit. If I select Continue, the installation will go on happily and ask to restart at the end. This is all fine and expected.
However, I need to do the upgrade unattended by running the msi with msiexec using the /quiet option, which will fail and according to the log, the problem is due to file in use.
How can I install a msi unattended using msiexec if a file is in use? I am looking for a way of getting msiexec to work unattended rather than doing all the work myself stopping my service, etc.

Try your re-installation after stopping the previous running service.
control panel->Administrative tools->services
select your service from the opened service listing window and stop your service.
Hope this solves your problem.

Related

How to automatically update an application installed with Inno Setup

I have an executable application setup.exe for Windows that I realized with Launch4j/Inno Setup based on Java.
I often frequently release new versions and bug fixes.
I would like to know if there is a mechanism to install updates automatically?
Inno Setup does not have any built-in mechanism for implementing automatic updates.
You need to implement that yourself:
Make your application check for new versions (against your application webpage?). E.g. on startup (on a background thread?)
If the application detects a new version, make it download an installer to a temporary location.
Make the application execute the downloaded installer. You can make the installer run in silent mode (/silent switch). The application should close itself, to unlock any files it is using, to allow files update.
This approach will need the update installer to prompt for Administrator privileges. If you need the update to proceed completely seamlessly, you will have to implement a service. For that, see Deploying application with .NET framework without admin privileges.

How to install Web Deploy for Hosting Servers on Windows Server 2016

The Web Platform Installer fails to install Web Deploy for Hosting Servers on Windows Server 2016.
To fix this, first install the missing components using Server Manager, Manage, Add Role and Features. I think these are the ones required: Logging Tools, Request Monitor, .Net Extensibility, ASP.Net, ISAPI Extensions, ISAPI Filters, Management Service. I ended up with the following for my needs.
Next install Web Deploy 3.6 for Hosting Servers using the Web Platform Installer. (If it fails, note which components it depended on, install as above and try again.)
At this stage if you look for Deploy again in the Platform Installer it won't be installed, even though it says it was successful.
Go to Control Panel, Add or Remove Programs, find Web Deploy and choose Modify, Next, then Change.
Set IIS Deployment Handler to Entire feature will be installed, Next etc.
The Deploy menu will now appear in IIS Manager (restart it first if you already had it open) and Web Platform Installer will see that it's installed.
I tried to follow franzos answer and even though it worked in the end and resolved my issue, there was one detail missing:
At this stage if you look for Deploy again in the Platform Installer
it won't be installed, even though it says it was successful.
Go to Control Panel, Add or Remove Programs, find Web Deploy and
choose Modify, Next, then Change.
Set IIS Deployment Handler to Entire feature will be installed, Next
etc.
On my windows server core there is no "Control Panel" or other access to "Add or Remove Programs"
What resolved it for me was downloading the .msi package for WebDeploy to the server and running it from cmd.
msiexec /L msdeployinstall.log /I <path_to_msi>
This runs the installation wizard and you can change the installation with:
Set IIS Deployment Handler to Entire feature will be installed, Next etc.
as described by franzo.
Best regards and thanks for the advice.
I just ran into this on a fresh azure server 2022 node and after doing all of Franzo's stuff it still didn't work.
I decided to connect the IIS on the new node to the IIS on the old node just to see what it did... I hit "Connect to a Server...", put in the IP of the old node, and when it connected it told me the new node was missing some extensions. The web deploy was one of them and it installed it for me.

How to install windows service with visual studio express

I have successfully created a Windows Service in c# in Visual Studio 2010 on my local machine. I have to deploy it on the server that has only Visual Studio Express edition. This means no command prompt available with the VS. How do I install the service this? Should it be through the computer command prompt?
You don't need VS to get the service installed, nor does it help in any way. Windows still provides you with the command prompt of course. Be sure to start it by right-clicking the shortcut with "Run as Administrator" so you have sufficient rights to modify the registry. Then type the full path of the install command:
cd \where\you\copied\it
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe yourservice.exe
Replace "Framework64" with "Framework" if this is a 32-bit machine. Be sure to get the server admin involved, he probably cares about you making changes to the machine. Most do anyway. And he can be helpful of course, including getting the account+password you need at the UAC prompt.
You should make program install himself as a service when run in non-service mode, the most reliable way (to me) to do it is using some P/Invoke, see CreateService.

windows service msi installer created in vs2003 hangs in win7 while installing

We have few windows services developed using .Net framework 1.1(VS2003).For each windows service an msi installer(set up project) is created to make installation easier.These installers are able to install windows services successfully in windows XP.But these installers unable to install windows service in WIN7 though I have admin privileges on the machine in which I am trying install them.While I am trying to install the windows service in win7, Through msi installer,installation is progressing till 90%.After that it is neither completing nor throwing an error.I am unable to understand what the problem is.
I tried following ways.
1.Opened cmd window in admin mode and tried to execute the msi with the command msiexec -i --Din't work
2.Right clicked on the actual exe(windows service exe) file and tried to run it in admin mode.--Din't work
3.Changed the UAC to never notify, restarted the machine and then tried to install--Din't work
4.Right clicked on both exe and msi and open their properties and changed the compatibility to lower version of windows and tried to install--Din't work
One thing I have noticed is that for all the custom actions of our windows service installer, primary output of our main project(exe) was given as input.I build the msi installer by removing all the custom actions.Then i tried to install it in win7.Then it was installed.But during the installation system not prompted for account details (which is the actual case while installing windows service) and also the service was not appeared in services manager window.
I spent somuch time to identify the cause and resolution.But I dint find any posts on this issue.I suspect that the problem is with custom actions.But not sure.If the problem is with custom actions please let me know how to overcome it.
Please provide a resolution for this issue or share me if there are any links which talks about this.
FWIW, .NET 1.1 isn't supported on Win7. Also I'm guessing you are using InstallUtil custom actions to drive the setup of your .NET Windows Service. These are very fragile and you can eliminate all those brittle points by refactoring and using the ServiceInstall ServiceControl tables in MSI.

VS2005 Setup and Deployment - MSI Installer on reboot

I built a VS 2005 Setup and Deployment project and i'm able to install the setup without any problems. But, if I reboot my computer, the setup utility is being run again, asking me to install the software again (It already exists). I have not run into this problem before, any help would be greatly apperciated.
Thanks!
Check the Event Log, it will show what missing component/file/whatever is causing the installer to run.
Try enabling Windows Installer Logging and looking at the log files to see what might be failing.
Validate your resulting MSI using Orca, it's available as part of the Windows Installer 4.5 SDK (look for orca.msi in the TOOLS folder)

Resources