WIX is not stopping windows service on unistall - c#

I am struggling with very strange situation with wix installer.
I have custom BA app which installs windows service and removes it on uninstall.
On Win XP everything is working perfectly but on Win 10 service is not stopped and not removed though uninstallation processed successfully.
In log files I cannot see any errors related to this.
Any ideas?
This is service install configuration:
<ServiceInstall
Id="MyServiceInstaller"
Type="ownProcess"
Name="MyService"
DisplayName="My Service"
Description="My Service"
Start="auto"
Account="[SERVICEACCOUNT]"
Password="[SERVICEPASSWORD]"
ErrorControl="normal" />
<ServiceControl Id="StartMyService"
Name="MyService"
Start="install"
Wait="no" />
<ServiceControl Id="StopMyService"
Name="MyService"
Stop="both"
Remove="uninstall"
Wait="yes" />

Round 2:
I jumped the gun here. As Chris says, we do need to see the log. I assumed the uninstall was hanging, which it does not seem to be at all.
ARP: I suppose you should quickly check if there are two product entries in Add / Remove Programs first of all? (don't think that is the problem either - failed major upgrade).
SharedDllRefCount: Is the SharedDllRefCount attribute set to yes for the service component? Please post the whole component markup, with all attributes specified - conditions and all. If the component was set permanent, that would explain things, but then the uninstall wouldn't work on XP. Enabling SharedDllRefCount sets the legacy ref-count here:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs
HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\SharedDLLs
Some SharedDllRefCount cleanup details here: MSI not uninstalling .dll files
Conditions Table: Are there any entries in the Condition table? (Feature conditions).
Round 1 (misunderstood the question - again - a couple of items still apply):
Debug Logging: Perhaps try to run your uninstall with verbose, debug logging to see if you can get some more information about what the problem can be:
msiexec.exe /x {ProductCode} /L*vx! C:\Your.log
Security Software: Is there anti-virus or security software on the problem box? If so, try to disable it before you run the uninstall.
Event Log: Maybe have a quick look for any clues in the event viewer? (Windows + Tap R. type eventvwr and pressOK). Check the different logs.
Custom Actions: Do you have any custom actions that run on uninstall? If so, what type of custom action? Managed code?
Service Credentials: Is the password for the service account still valid on that problem box? If worst comes to worst, can you log on with those service credentials (if that is possible) and try to start and stop the service to check for errors? Maybe even try to run the service with your own admin account? This is not ideal any of it, and should only be done to get to the bottom of this.
There have been a lot of service questions on StackOverflow lately. Here are some recent answers:
Wix - ServiceControl start takes four minutes to fail, should be 30 sec
Wix Service Installer sometimes fails to install or start
Wix installer: installed service unable to read HKLM registry entries on start

Related

I am not able to create msi setup using installshield for self hosted console application

I have created self-hosted WCF service using Console application. I have created msi using Installshield but when I am installing setup it will stuck and after some time failed to setup.
I have added log in code and found that on the line of hosting WCF service it was going to stuck and throw an error.
Any Idea how can I resolve this issue?
Service Install: Can you install and run it manually? You must install with admin rights, if you specify a user account to run the service it must have the "log on as a service" privilege (check by running secpol.msc or see here), the file you install must actually be a proper service - obviously - I sometimes mix up my test executables with the service binary. Ever forget? Happens to me :-).
Logging: Get yourself a proper log file first of all:
msiexec.exe /i "Setup.msi" /L*V "C:\Setup.log"
Or in silent mode:
msiexec.exe /i "Setup.msi" /QN /L*V "C:\Setup.log"
Some more information on Logging:
Installsite.org on logging
Event logging, etc...
Interpreting MSI log files, etc...
Credentials: Just adding that there are several built-in accounts you can use to run the service:
The difference between the 'Local System' account and the 'Network Service' account?
And there is the new concept of "managed service accounts". Step-by-Step.
And finally "group managed service account".

Upgrading wp8 to wp8.1 silverlight, debugger cannot be launched

I have now had an error with VS2013 and WP8.1 silverlight for a couple of days.
I get a couple of different errors, ..Ensure unlocked screen.., AgHost.exe could not be launched, port is in use by another program and ensure the device is unlocked.
These errors came suddenly after I retarged the solution. I have no compiling errors.
Solution Attempts
Restart PC
Restart program
unregister and reregister the phone
reinstall Update 3
reinstall VS2013
Windows Phone 8 Application crash once its launched AgHost.exe' has exited with code -532265403
Install VS2015 with no luck.
reinstall VS2013 Update 4
Nothing worked. The error is also the same for emulator as well as different devices. I can however get the release mode installed. Break points can be used when using release mode, but I have to Clean, Rebuild and then deploy for every time I want to deploy the application. Further the deploy time has gone up exponentially. Before upgrading I used a maximum of 10 seconds. Now it is above a minute in wait time. :/
Anyone has a solution for this ?
Extra
If I run the solution before upgrade on device or Emulator It spins up with debugger. If then go to the updated WP81, I get a popup with info Something is taking longer then normal and then it crashes with ..Ensure unlocked screen.. :/
Could it be an issue with the differen SDKS?
During a repair of all the SDKs, I found an issue with the event log, which I cleared based on The Event Log File is full
Still no success.
Extra
I cannot spin up the emulator from VS2013, when using the WP8.1 solution, but the wp8.0 solution in the same VS works :S
I found an error in a log file, from:
The errors are:
[0F08:14A8][2015-07-23T09:11:44]: Applying execute package: silverlight5_DRT, action: Repair, path: C:\ProgramData\Package Cache\DEB5078B60B74431E2830831EB48DF129CB32932\packages\Silverlight\5.0_DRT\Silverlight_Developer.exe, arguments: '"C:\ProgramData\Package Cache\DEB5078B60B74431E2830831EB48DF129CB32932\packages\Silverlight\5.0_DRT\Silverlight_Developer.exe" /q /ignorewarnings'
[0F08:14A8][2015-07-23T09:11:45]: Error 0x800705de: Process returned error: 0x5de
[0F08:14A8][2015-07-23T09:11:45]: Error 0x800705de: Failed to execute EXE package.
[0550:0E74][2015-07-23T09:11:45]: Error 0x800705de: Failed to configure per-machine EXE package.
[0550:0E74][2015-07-23T09:11:45]: MUX: Installation size in bytes for package: silverlight5_DRT MaxAppDrive: 0 MaxSysDrive: 0 AppDrive: 0 SysDrive: 0
AND
[0F08:14A8][2015-07-23T09:16:16]: Applying execute package:
{312d9252-c71c-4c84-b171-f4ad46e22098}, action: Repair, path:
C:\ProgramData\Package
Cache{312d9252-c71c-4c84-b171-f4ad46e22098}\VS2012.4.exe, arguments:
'"C:\ProgramData\Package
Cache{312d9252-c71c-4c84-b171-f4ad46e22098}\VS2012.4.exe" -repair
-quiet -burn.related.patch' [0F08:14A8][2015-07-23T09:16:23]: Error 0x80048bc7: Process returned error: 0x80048bc7
[0F08:14A8][2015-07-23T09:16:23]: Error 0x80048bc7: Failed to execute
EXE package. [0550:0E74][2015-07-23T09:16:23]: Error 0x80048bc7:
Failed to configure per-machine EXE package.
Anybody knows what to do with this? The error is coming when I repair Windows Phone SDK 8.0
There was a post-VS2013 update for the Windows Phone 8.1 SDK, some odds that you don't have it installed since you did not need it before. The download location is here.
Getting error messages like "port is in use" when there's no obvious reason why it should be in use and seeing excessive download times is also a very strong selector for your installed anti-malware product getting in the way. No specific advice on how to configure it when we don't know what it might be. You definitely first want to try to temporarily disable it so you can identify it as the source of the problem.
I have no Idea of what is the issue, but creating a new solution and importing the existing projects into a new solution has solved all the issues regarding emulator and debugger an AgHost.
Seems like the upgrade function integrated in the solution did not work properly.

WIX-Installer ServiceControl "sufficient privileges" error

Visual Studio 2015 RC
Wix v3.10.0.1726
I am creating a installer for a windows services. I've tested the service with InstallUtil and it runs fine. Unfortunately I'm having a bit of troubles with wix, here is the exact error -
"Service 'Service Name' failed to start. Verify that you have sufficient privileges to start system services."
Now I've narrowed down the issue to starting the service through WIX. If I forgo the ServiceControl tag and manually start it with services.msc it works fine.
From other questions it appears this error is a general catch error and occurs in a variety of situations. The most popular being if your service relies on assemblies installed to the GAC (Global Assembly Cache) which I am also unclear about. I never implicitly save anything to the GAC and my service simply calls a .cs file I wrote that is included in the project.
Any help would be greatly appreciated!
<Component Id="ProductComponent7">
<File Source="$(var.ServiceName.TargetPath)" KeyPath="yes" Vital="yes"/>
<ServiceInstall Id="ServiceName.exe"
Account="LocalSystem"
Arguments="-start"
Type="ownProcess"
Name="ServiceName.exe"
DisplayName="ServiceName Service"
Description="sdfg"
Start="auto"
Interactive="yes"
ErrorControl="critical" />
<ServiceControl Id="ServiceControl" Name="ServiceName" Start="install" />
</Component>
I've also tried a variety of different attributes in ServiceControl, I recently removed them all to try to make it as simple as possible.
If anyone has any insight that'd be great!
The issue appears to be that you've installed a service called ServiceName.exe and you're trying to start a serice called just ServiceName. The Name values need to match.
Correct, it's a generic error. You have to profile your service to understand why it won't start.
GAC is just one scenario. In that case it's because MSI doesn't publish assemblies to the GAC until after StartServices. A classic race condition that results in a missing dependency and error.
With the message box still up, run the EXE from the console. Do you get an errors? Do you get any errors in your application log? Find out why the service won't fix, resolve it and try again.
For me, the error was due to that Name attribute in the ServiceInstall tag was having a different name value from the one specified in the ServiceBase child class InitializeComponent() method.
Code updates:
In Product.wxs:
<ServiceInstall Id="ServiceInstaller"
Type="ownProcess"
Name="MyWindowsService"
DisplayName="$(var.ServiceDisplayName)"
Description="$(var.ServiceDiscription)"
Start="auto"
Account="LocalSystem"
ErrorControl="normal" />
In ServiceBase child class:
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.ServiceName = "MyWindowsService";
}

Brokered components when using TFS Build

When using TFS to build my application, it fails when I have an application with Brokered components.
Here is what I am using in my Package.appxmanifest, and it works when I build/run locally. How can I still build/deploy using TFS and keep my brokered components? Is this possible?
<Extensions>
<Extension Category="windows.activatableClass.inProcessServer">
<InProcessServer>
<Path>clrhost.dll</Path>
<ActivatableClass ActivatableClassId="BrokeredRuntimeComponent.{ClassName}" ThreadingModel="MTA">
<ActivatableClassAttribute Name="DesktopApplicationPath"
Type="string"
Value="C:\Source\{AppName}\Debug\BrokeredRuntimeComponentProxy" />
</ActivatableClass>
</InProcessServer>
</Extension>
</Extensions>
When I run the build, I get the following error. I do not have access to run the regsvr32 /s on our TFS. Is this something that needs to be done on every client or can it be done on the build server and run on every device? I think it might work if it's possible to get the build service to run as administrator. Is this even possible?
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets (1620): Failed to register output. Please try enabling Per-user Redirection or register the component from a command prompt with elevated permissions.
Please let me know if anything I've put here is unclear so I can hopefully clarify.
You need to have everything installed on your build server that your need to run a build locally. If you need certain registered components then that needs done in advance or at build time.
If at build time then the account that TF build runs under needs permission to perform that action.

My service failed to uninstall

I recently tried to change the display name of my windows service, but apparantly I messed up. An old version fails to uninstall completely and I cannot install a new version of the windows service. This is the error generated from running installutil /i myService:
An exception occurred during the uninstallation of the System.Diagnostics.EventLogInstaller installer.
System.InvalidOperationException: The event log source '7 Ac Service' cannot be deleted, because it's equal to the log name.
An exception occurred while uninstalling. This exception will be ignored and the uninstall will continue. However, the application might not be fully uninstalled after the uninstall is complete.
So the event log source is equal to the log name. What does that mean and how do I fix it?
I found out myself. This post helped. So there are basically 3 places in the registry in the same name as the windows service. So I tried first to write a console application to remove the eventlog:
System.Diagnostics.EventLog.Delete("7 Ac Service");
It took care of 2 of them. I removed the last one manually using regedit. Then my windows service installed without problems.

Categories