I have a complex WIX installer that does various tasks / MSIs. One of the MSIs installs a service after which a Database MSI runs and updates the app.config for that service to contains the correct connection strings.
Currently the service is started after it is installed (this is before the Database MSI runs) meaning it has incorrect connection strings. How can I make the service start as the very last item in the installer so that it has the correct connection strings.
I assume this could be in the Bundle of the Bootstrapper but I cannot get that to work. Here is the current code within the Product.wxs which starts the service.
<ServiceControl Id="StartEMService" Start="install" Name="EMService"/>
Bundles only operate on packages so things like controlling services aren't supported. Your database package should have a ServiceControl element to stop (just in case) and restart the service. Schedule the action that updates the config file to be before the StartServices standard action.
Related
Have an MSI file with multiple Windows Services. Running the MSI file creates an instance of each service. However, I am unable to install another instance of each service (or one of the contained services).
Have tried a few suggestions online but they seem more suited for EXE files. have tried MSINEWINSTANCE but from my understanding, this requires a .mst file which we don't have or know how to create.
Ideally, create each service with a "_#' at the end (where # is instance of the service.
I have configured a CI build for a Service Fabric application, in Visual Studio Team Services, according to this documentation: https://azure.microsoft.com/en-us/documentation/articles/service-fabric-set-up-continuous-integration
But instead of having my CI build do the publishing, I only perform the Build and Package tasks, and include all Service Fabric related output, such as pkg folder, scripts, publish profiles and application parameters, in the drop. This way I can pass it along to the new Release pipeline (agent-based releases) to do the actual deployment of my service fabric application.
In my release definition I have a single Azure Powershell task, that uses an ARM endpoint (with proper service principals configured).
When I deploy my app to an existing service fabric cluster, I use the default Deploy-FabricApplication cmdlet passing along the pkg folder and a publish profile that is configured with a connection to the existing cluster.
The release fails with an error message "Cluster connection instance is null". And I cannot understand why?
Doing some debugging I have found that:
The Deploy-FabricApplication cmdlet executes the Connect-ServiceFabricCluster cmdlet just fine, but as soon as the Publish-NewServiceFabricApplication cmdlet takes over execution, then the cluster connection is lost.
I would expect that this scenario is possible using the service fabric cmdlets, but I cannot figure out how to keep the cluster connection open during depoyment.
UPDATE: The link to the documentation no longer refers to the Service Fabric powershell scripts, so the pre-condition for this question is no longer documented. The article now refers to the VSTS build and release tasks, which can be prefered over the powershell cmdlets I tried to use.
When the Connect-ServiceFabricCluster function is called (from Deploy-FabricApplication.ps1) a local $clusterConnection variable is set after the call to Connect-ServiceFabricCluster. You can see that using Get-Variable.
Unfortunately there is logic in some of the SDK scripts that expect that variable to be set but because they run in a different scope, that local variable isn't available.
It works in Visual Studio because the Deploy-FabricApplication.ps1 script is called using dot source notation, which puts the $clusterConnection variable in the current scope.
I'm not sure if there is a way to use dot sourcing when running a script though the release pipeline but you could, as a workaround, make the $clusterConnection variable global right after it's been set via the Connect-ServiceFabricCluster call. Edit your Deploy-FabricApplication.ps1 script and add the following line after the connection logic (~line 169):
$global:clusterConnection = $clusterConnection
By the way, you might want to consider setting up custom build/release tasks that deploy a Service Fabric application, rather than using the various Deploy-FabricApplication.ps1 scripts.
There now exists a built-in VSTS task for deploying a Service Fabric app so you no longer need to bother with executing the PowerShell script on your own. Task documentation page is at https://www.visualstudio.com/docs/build/steps/deploy/service-fabric-deploy. The original CI article has also been updated which provides details on how to set everything up: https://azure.microsoft.com/en-us/documentation/articles/service-fabric-set-up-continuous-integration/.
Try to use "PowerShell" task instead of "Azure PowerShell" task.
I hit the same bug today and opened a GitHub issue here
On a side note, VS generated script Deploy-FabricApplication.ps1 uses module
"$((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Service Fabric SDK" -Name "FabricSDKPSModulePath").FabricSDKPSModulePath)\ServiceFabricSDK.psm1"
That's where Publish-NewServiceFabricApplication comes from. You can check the deployment logic and rewrite it in more sane way using lower-level ServiceFabric SDK cmdlets (potentially getting connection using Get-ServiceFabricClusterConnection instead of global-ling it)
I have installed DB2 server on windows 2008 R2 server. A default instance 'DB2' was created at the time of installation.
I am building up an environment for Identity manager, and used it's configuration utility to create necessary steps required for connection between the Identity manager and database.
This utility creates another instance and database for the identity manager. However, I do not see this second instance appearing on the system tray icon.
I even performed a windows server restart but still the second instance created is not appearing. Verified from the services window that services for both the instance is started and running.
What could be the reason ?
The instance process creation does not include that cosmetic part. This is included as part of the installation process, but not when creating additional instances.
You can add a second systray icon by calling the db2systray.exe as a starting process: msconfig.exe. You have to provide the name of the instance to "monitor":
For more information, consult the KnowCenter: http://www-01.ibm.com/support/knowledgecenter/SSEPGG_10.5.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0011771.html?cp=SSEPGG_10.5.0%2F3-5-2-6-117
So basically what I'm trying to do is to have a number of additional parameters (namely SERVICENAME and SERVICEDISPLAYNAME) in the installer of my application (which runs a service) instead of hard-coding them in the installer. The installation runs fine with this change. However the problem I have is when I run a silent uninstall. It appears that the Service Control does not stop the service before removing it from the machine and I get a dialog box telling me that the service is still running and asking me if I want the service to be stopped before uninstalling it. What should I do to make it work (i.e. make the service control to stop the service automatically before removing it)?
The ServiceControl Element is just an abstraction for the underlying ServiceControl Table. Neither "do" anything. Instead, they merely express what needs to be done. The stopping of services is performed by the StopServices Action which gets it's orders from the aforementioned table.
In Windows Installer, properties are not persisted automatically after an installation is complete. If you log the installer you will likely find that your SERVICENAME property is null and the StopServices action doesn't know what to do with that.
Take a look at the following:
The WiX toolset's "Remember Property" pattern
If you implement this pattern, the data for SERVICENAME should be restored during the uninstall and the
Recently I tried to enumerate the Windows Services on the VM where my Azure web role instance runs using ServiceController.GetServices() - there's a lot of them including Telephony and CloudDrive which I don't need and so having them started is a waste of resources.
Is it possible to have them not started?
Yes, but you'll need a startup task to do this. Here is what you'll do to stop and disable the Telephony service:
sc.exe stop TapiSrv
sc.exe config TapiSrv start= disabled
As you can see I'm not using the display name (Telephony) but I'm using the service name (TapiSrv). If you want to get a list of service names for your system you can simply execute this command (in Azure you can do this via RDP):
sc.exe query
Executing this command will also give you the state of the service (running, ...).
Note: When calling sc.exe config you need to put a space after the equals sign.
Note: Stopping services can take some time, so I suggest you use a background task to stop/disable the services, in order to keep the startup time of your instance to a minimum.