Uninstall leads to 1603 error on windows 10 1703 - c#

We have a Windows 10 1607 image with our app installed via Advanced Installer.
We then updated the app to a new version and the update worked as excepted.
However if we do the same procedure but with a Windows 10 1703 image, the upgrade of our app fails with the following error:
MSI (s) (58:B8) [16:12:02:846]: Note: 1: 2769 2: ShopInstallClass_x64 3: 1
Error 1001. Error 1001. The specified service has been marked for deletion
Info 2769. Custom Action ShopInstallClass_x64 did not close 1 MSIHANDLEs.
CustomAction ShopInstallClass_x64 returned actual error code 1603 (note this
may not be 100% accurate if translation happened inside sandbox)
MSI (s) (58:EC) [16:12:02:858]: Note: 1: 2265 2: 3: -2147287035
MSI (s) (58:EC) [16:12:02:860]: User policy value 'DisableRollback' is 0
MSI (s) (58:EC) [16:12:02:860]: Machine policy value 'DisableRollback' is 0
Action ended 16:12:02: InstallExecute. Return value 3
The custom action above refers to a windows service which is being uninstalled and then reinstalled with the new update. I tried putting a stop service and even a stop process to see if that would work (possibly handles left open) and the installer still did not work.
Any ideas why this is happening?

The code in the custom action has crashed, I assume you know that. Without showing more of the log it's also not clear where in the upgrade it's happening, if in fact you're referring to a major upgrade when you say "update". In a major upgrade there's an install of the new product and an uninstall of the older one - where is this crash happening in that sequence? It's also possible that your ShopInstall class is an installer class to install a service, which isn't necessary because Windows Installer has ServiceInstall actions for that.
Having said that, the message "The specified service has been marked for deletion" implies that the code is trying to do something to a disabled service. So it looks like a previous uninstall of the service has been attempted, and the service did not shut down or stop correctly. In that situation Windows will mark the service disabled and then a reboot will finally delete it. In the meantime if something tries to do something with that service it will fail with the "pending deletion" error. So you'd have to go back to whatever uninstall was attempted and why it failed to first stop, and then uninstall the service.

Related

Windows Service - UnauthorizedAccessException Error when Installing Service (C#)

So I am trying to create a service using C# in Visual Studio 2017 and I keep getting an error when I try to install it.
Right now, I don't even have anything in my service, I just want to be able to install the service. I created a new Project in Visual Studio 2017 using the Windows Service (.NET Framework) template under Visual C# > Windows Desktop. I then added the installer via Right Click > Add Installer. For serviceProcessInstaller1, I set the account to LocalSystem. And...that's it!
Now, I try to install it. I open up command prompt (run as administrator) and I do
InstallUtil ServiceTest.exe
Things start off smoothly, but then I get a message:
"An exception occured during the Install phase.
System.UnauthorizedAccessException: Attempted to perform an
unauthorized operation."
What could be generating this message?
I've googled and tried the following things:
Ensure I run command prompt as administrator.
Assign Full Control to
the project folder to my admin account.
Configure permissions to Full
Control for admin account in the security log of regedit.
Log into my
computer as an administrator (rather than regular user) and run it
that way.
Despite these things, I keep getting the same error. What else could I be doing wrong? Would really appreciate some advice!
Note: I am trying to install this service locally on my computer.
Edit: Per request, here are the logs. I named my project "FailedService", by the way, since I can't get it to work!
InstallUtil.InstallLog
Running a transacted installation.
Beginning the Install phase of the installation.
See the contents of the log file for the C:\Users\first.m.last\source\repos\FailedService\FailedService\bin\Debug\FailedService.exe assembly's progress.
The file is located at C:\Users\first.m.last\source\repos\FailedService\FailedService\bin\Debug\FailedService.InstallLog.
An exception occurred during the Install phase.
System.UnauthorizedAccessException: Attempted to perform an unauthorized operation.
The Rollback phase of the installation is beginning.
See the contents of the log file for the C:\Users\first.m.last\source\repos\FailedService\FailedService\bin\Debug\FailedService.exe assembly's progress.
The file is located at C:\Users\first.m.last\source\repos\FailedService\FailedService\bin\Debug\FailedService.InstallLog.
The Rollback phase completed successfully.
The transacted install has completed.
FailedService.InstallLog
Installing assembly 'C:\Users\first.m.last\source\repos\FailedService\FailedService\bin\Debug\FailedService.exe'.
Affected parameters are:
logtoconsole =
logfile = C:\Users\first.m.last\source\repos\FailedService\FailedService\bin\Debug\FailedService.InstallLog
assemblypath = C:\Users\first.m.last\source\repos\FailedService\FailedService\bin\Debug\FailedService.exe
Installing service Service1...
Creating EventLog source Service1 in log Application...
Rolling back assembly 'C:\Users\first.m.last\source\repos\FailedService\FailedService\bin\Debug\FailedService.exe'.
Affected parameters are:
logtoconsole =
logfile = C:\Users\first.m.last\source\repos\FailedService\FailedService\bin\Debug\FailedService.InstallLog
assemblypath = C:\Users\first.m.last\source\repos\FailedService\FailedService\bin\Debug\FailedService.exe
Restoring event log to previous state for source Service1.
I was FINALLY able to resolve this issue. I was able to get to the bottom of it by using SysInternal's Process Monitor. I opened up the program and had it take logs for InstallUtil.exe. From there, I began to search for any logs that said "Access Denied". As I sorted through them, I noticed something interesting: it was trying to create a registry key, but it kept failing!
So I went into the registry and created a key named "ServiceTest". After that, I ran the InstallUtil command again, and it worked!
If anyone else is having trouble, the solution is to create a key named after your process name in the following location:
HKLM\System\CurrentControlSet\Services\EventLog\Application\
Enter the full path to installUtil & your service binary in an elevated prompt, that could do.

C# setup doesn't t start in Windows Xp

i've created a Visual Studio Installer in .NET 4.0 for my Windows Service.
The installer works on my computer (Windows 10 64 bit), on Windows 7(32 bit) but it doesn't work on Windows Xp 32 bit, the installer doesn't start and appears a window with this message:
"Installation doesn't complete. Installation program interrupted
before the installation of " ". Start the installation program again before
trying again. Choose Close to exit".
.NET 4.0 is installed.
There is no other details, what can i do for debugging the problem?
Thank you very much for your attention
Some chunk of LogFile.txt:
Start operation 13:19:48: INSTALL. 13:19:48 Operation: DIRCA_CheckFX.
Start operation 13:19:48: DIRCA_CheckFX. Action ended 13:19:48:
DIRCA_CheckFX. Return value 3. 13:19:48 Operation: FatalErrorForm.
Start operation 13:19:48: FatalErrorForm.
2898. Information VSI_MS_Sans_Serif13.0_0_0, MS Sans Serif, 0
2898. Information VSI_MS_Sans_Serif16.0_1_0, MS Sans Serif, 0 DEBUG: Error 2826: Control Line2 on dialog FatalErrorForm extends beyond the
boundaries of the dialog to the right by 3 pixels There was an
unexpected error installing this package. Likely problem with this
package. The error code is 2826. The arguments are: FatalErrorForm,
Line2, to the right DEBUG: Error 2826: Control BannerBmp
FatalErrorForm on dialog extends beyond the boundaries of the dialog
to the right by 3 pixels There was an unexpected error installing this
package. Likely problem with this package. The error code is 2826. The
arguments are: FatalErrorForm, BannerBmp, to the right
2898. Information VsdDefaultUIFont.524F4245_5254_5341_4C45_534153783400, MS Sans Serif,
0 DEBUG: Error 2826: Control Line1 on dialog FatalErrorForm extends
beyond the boundaries of the dialog to the right by 3 pixels There was
an unexpected error installing this package. Likely problem with this
package. The error code is 2826. The arguments are: FatalErrorForm,
Line1, to the right 13:19:48 Operation: FatalErrorForm. Dialog created
Action ended 13:19:52: FatalErrorForm. Return Value 1. Action ended
13:19:52: INSTALL. Return value 3.
Property (C): VSDNETURLMSG = Setup requires .NET Framework version
[1]. Install .NET Framework and run setup again. You can obtain the
.NET Framework from the Web. Downloading now? Property (C): VSDIISMSG
= The installer requires Internet Information Server 5.1 or later, and Windows XP or later, and can not run on Windows 2000. Install Internet
Information Server or a more recent operating system and run the
installer. Property (C): = VSDUIANDADVERTISED This announcement will
not be installed because it might be unreliable. Contact your system
administrator to change the package installation in the basic option.
Property (C): VSDNETMSG = The installation program requires the .NET
Framework version [1]. Install .NET Framework and rerun the installer.
Property (C): VSDINVALIDURLMSG = The specified path '[2]' is
unavailable. Internet Information Server might not be running or you
can that the path exists and is redirected to another computer. Check
the status of this virtual directory in Internet Services Manager.
Property (C): VSDVERSIONMSG = Unable to install. The latest version of
the product is already installed
.
DIRCA_CheckFX is the VS setup custom action that checks for the .NET Runtime, and it's failing, that's why it returns 3, and the rest of it is just whining about the dialogs not being perfect.
You didn't say which version of VS setup you're using, but the most likely explanation is that XP (which is unsupported) is missing some dependency (or OS API) that the custom action code needs. Or it's using a search for the runtime that is inappropriate for a runtime installed on XP. If you built your setup with an ancient VS setup (VS 2003 or VS 2005) it might have more chance of working because XP was supported when they were around.
From the log, the error looks like it is to do with the error dialog ironically.
I think that the dialog is about 3px too small on XP for some reason. If you make the error dialog slightly larger, or the controls slightly smaller, you may fix the issue, or more likely, get a better error message. I've extracted the relevant bits from the log.
DEBUG: Error 2826: Control Line2 on dialog FatalErrorForm extends
beyond the boundaries of the dialog to the right by 3 pixels
DEBUG: Error 2826: Control BannerBmp FatalErrorForm on dialog extends
beyond the boundaries of the dialog to the right by 3 pixels
DEBUG: Error 2826: Control Line1 on dialog FatalErrorForm extends
beyond the boundaries of the dialog to the right by 3 pixels
I avoid VS Installer like the plague, so if you can't modify the dialog in there, try using an MSI Editor like InstEdit (freely downloadable).

SSIS Package failing because "script task is failing because the script is not precompiled"

I developed a pretty straight forward SSIS package (in VS2005 w/ .Net Framework V 2.0.50727 SP2) that gets a list of users to email, starts a for-each loop container and then executes a script task to retrieve user specific data and email it out to the user. When I run it on my dev box everything works great and runs as it should. However when I deploy the package to our production server running (Microsoft SQL Server 2005 - 9.00.5000.00 (X64) Standard Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 2) ) the task fails.
The original error message is:
Executed as user: xxxxx. Microsoft (R) SQL Server Execute Package Utility Version 9.00.5000.00 for 64-bit Code: 0x00000009 Source: PackageName Description: The task cannot execute in 64-bit environment because the script is not pre-compiled. Please turn on the option to pre-compile the script in the task editor. End Error ... Error DTExec: The package execution returned DTSER_FAILURE (1).
After researching that extensively the interwebs suggested that I try:
running the package in 32bit by changing the execution property in the SQL job and by changing my RunIn64BitMode property from true to false
which fails because " Option "/X86" is not valid."
install the Microsoft Hotfix
which doesn't apply since I am already running on SP2
So after more research I find that I need to turn on "Please turn on the option to pre-compile the script in the task editor." SOURCE: ssis-dtsx DOT blogspot DOT com/2010/03/cannot-execute-in-64-bit-environment.html
Which entails:
Make sure that each script task has PreCompile = True
Open Script Task Editor, switch to Script tab and make sure that
PrecompileScriptIntoBinaryCode = True
Click on Design Script to open code editor (Visual Studio for Applications) and then choose it using File > Close and Return (VSA will recompile and store binary code in the package).
Build Project and copy to target location
However when I execute the package I immediately get the error:
Executed as user: xxxx. ...0.5000.00 for 64-bit Code: 0x00000008 Source: PackageName Description: The task is configured to pre-compile the script, but binary code is not found. Please visit the IDE in Script Task Editor by clicking Design Script button to cause binary code to be generated. End Error Code: 0x00000008 Source: GET PO infor and Email Description: Script could not be recompiled or run: Retrieving the COM class factory for component with CLSID...
So my final step was to turn DelayValidation property from False to True in the SSIS pkg, go into the design script to cause it to be rebuilt, then redeploy, and rerun and I still get the same error.
On searching the error I am directed to Microsoft HOT FIX which suggested that I download another hotfix.
I have not yet downloaded the hotfix, and would prefer not to if I can avoid it (our OPs team doesnt like running hotfixes mid day on production servers).
Go to the package, open the script component, then within Visual Studio (while looking at the code) click on BUILD. This will compile the package, if there are no issues preventing it from compiling. Then SAVE, go back and ensure that you click on "OKAY" and not "cancel", if you click on cancel then the whole thing reverts back.

cannot uninstall a windows service: "...cannot be deleted, because it's equal to the log name."

I need to uninstall a Windows Service I have created, but I get this error using the "Uninstall or change program" program in windows:
Error. 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. -> The
event log source '111 My Service'
cannot be deleted, because it's equal
to the log name.
Then I click "OK" and the program remains listed in the list of installed programs. What is worse, I cannot install a new version of it. The windows installer says that another version of this product is already installed and I should uninstall it first. How do I get rid of this program?
Update Here is what is happening when I run InstallUtil.exe /u command on it.
The uninstall is beginning. See the
contents of the log file for the
C:\MyService.MyService. assembly's progress. The file
is located at
C:\MyService.MyService.InstallLog.
Uninstalling assembly
'C:\MyService.MyService.exe'. Affected
parameters are: logtoconsole =
assemblypath = C:\MyService.exe
logfile =
C:\MyService.MyService.InstallLog
Removing EventLog source 111 My
Service. An exception occurred during
the uninstallation of the
System.Diagnostics.EventLogInstaller
installer.
System.InvalidOperationException: The
event log source '111 My 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 uninstalle l is
complete.
The uninstall has completed. An
exception occurred while uninstalling.
This exception will be ignored and the
uninstall will continue. However, the
application might not be fully
uninstalle l is complete.
Try to execute next command in cmd:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe /u "c:\myservice.exe"
The second option is:
sc delete <service name>
After running the line above you can try to remove the service branch as well in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services.
The accepted answer didn't work for me.
What worked is open regedit in administrator mode and find the service and delete it.
I had the exact same problem (and nothing in the selected answer worked).
Surprisingly, what fixed the problem was (using the standard "Uninstall or change program" or "Programs and Features" windows dialog) right-clicking on the program and choosing repair (this was apparently successful), and then uninstalling.
This just happened to me and the solution above didn't work where you run the InstallUtil.exe or delete the service. I had initially set up my service with the "LocalSystem" security context, and it was installed with that. I later changed the security context to "User" and recompiled the service executable and tried to uninstall the old service. The error messages were coming up that are described here, and once I went and changed the security context back to "LocalSystem" I could fully uninstall.
In other words, you might want to uninstall your old service with the executable it was created with rather than a newer one with possible modifications.

WiX Custom Action to check firewall status causes installer to fail

I have implemented a WiX Custom Action in C# to check whether the Windows firewall is on or off.
I tested the code with a C# console application and it worked without problems.
However, when I use the code in a WiX Custom Action it causes the installer to fail at run-time, with the following error in the msiexec error log:
DEBUG: Error 2755: Server returned unexpected error 1622 attempting to
nstall package MyInstaller.msi.
The installer has encountered an unexpected error installing this package.
This may indicate a problem with this package. The error code is 2755.
The arguments are: 1622, MyInstaller.msi,
Action ended 11:26:30: ExecuteAction. Return value 3.
Action 11:26:30: FatalError.
Action start 11:26:30: FatalError.
Action 11:26:30: FatalError. Dialog created
Action ended 11:26:31: FatalError. Return value 2.
Action ended 11:26:31: INSTALL. Return value 3.
Type NetFwMgrType = Type.GetTypeFromProgID("HNetCfg.FwMgr", true);
INetFwMgr fwMgr = Activator.CreateInstance(NetFwMgrType) as INetFwMgr;
bool Firewallenabled = fwMgr.LocalPolicy.CurrentProfile.FirewallEnabled;
MessageBox.Show("Firewall enabled: " + Firewallenabled.ToString());
In my WiX XML file the CA is like this:
<CustomAction Id="CheckWindowsFirewallId"
BinaryKey="CustomActions.dll"
DllEntry="CheckWindowsFirewall" Execute="deferred" Impersonate="no" Return="check"/>
<InstallExecuteSequence>
<Custom Action="CheckWindowsFirewallId" After="InstallInitialize">NOT Installed</Custom>
I am using Visual Studio 2005, Windows XP, WiX version 3.6.1321.0
I am logged in as admininstrator.
I know exactly which line causes in the problem.
If I comment out the line with "Activator.CreateInstance(NetFwMgrType)" the error does not occur.
I have tried several different combinations of 'deferred' and 'impersonate' with no success.
If I can't get it to work I will try the WiX Firewall Extension instead, but it would be great if someone has an idea why it doesn't work.
There isn't enough information to know for sure. However, my magic eight ball guesses that the assembly your trying to activate a class out of isn't available. The best thing would be to get a debugger on the code and look at the exception. If you're having trouble doing that, catching the exception and writing it to the log file might be useful as well.
I also agree with Yan's comment above. I'd recommend using the built in support for Firewalls in WiX instead of writing your own code if possible.

Categories

Resources