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

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.

Related

How to Deploy a Windows Service using Visual Studio 2017 Community

Working with VS2017 Community I have written a service that works on my local machine. I followed the instruction here:
https://learn.microsoft.com/en-us/dotnet/framework/windows-services/walkthrough-creating-a-windows-service-application-in-the-component-designer
and installed it successfully using Installutil.exe (as per instructions in above link). All good.
I now want to deploy that across six servers in our organisation. In Microsoft's documentation about installing services (https://learn.microsoft.com/en-us/dotnet/framework/windows-services/how-to-install-and-uninstall-services) it says:
If you’re a developer who wants to release a Windows Service that users can install and uninstall you should use InstallShield
and links to a page that applies to VS2012 (can't post any more links as my reputation<10)
I have downloaded and installed the "Microsoft Visual Studio 2017 Installer Projects" package, which allows me to create a Setup Project. When I run it, it installs the project output correctly (i.e. copies the exe & dll files to the correct folder in Program Files) but does not create the service.
There's a detailed post about deploying services on this site (question 9021075) but when I follow those instructions I get a 1001 error on Install.
All the documentation I can find refers to earlier versions of VS or the previous Installer package, so I'm not even certain if I can do it with the software I am using.
So, with VS2017 Community using Microsoft Visual Studio 2017 Installer Projects, how to I create a stand-alone Installer to deploy a service that works correctly when installed locally using InstallUtil?
Or can I use InstallUtil on the target machines? I think I'd need to install Visual Studio on them for that, which I'd prefer not to. Is there a quicker way?
I only have 6 servers to install this on, so even some manual work-around might do.
Thank you for the responses. I now have a solution. I found InstallUtil on the Target Server (in my case it was in C:\Windows\Microsoft.NET\Framework64\v4.0.30319 but search will find it). I copied and added that to my project as content so when I now deploy it, I have InstallUtil in the same folder as my EXE.
To install, I run CMD as admin, cd to project folder and issue command:
installutil.exe myService.exe
This is a one-off task. Once the service is working, to update it I just need to stop it, upload the new myService.exe (& any DLLs) to overwrite the old ones and restart it again.
Further information about settings you're using for the serviceProcessInstaller1 and serviceInstaller1 files will be needed to debug this issue, as the 1001 error raised by the installer is a generic error.
An alternative way of doing this is to use Topshelf, which is a framework for hosting services written using the .NET framework. It simplifies the creation of services, allowing developers to create a simple console application that can be installed as a service using Topshelf. The reason for this is simple: It is far easier to debug a console application than a service. And once the application is tested and ready for production, Topshelf makes it easy to install the application as a service.
Alternatively, you could use InstallUtil.exe. It is part of the .NET Framework, so no need to install Visual Studio.

Installer package targeting Windows Installer 3.1 fails when Windows Installer 4.5 has been installed

We have an installer package authored with InstallShield 2009, targeting Windows Installer 3.1.
Recently, we started to notice that sometime, when installing on some Windows 2003 R2 x86 based hosts, the installation fails, and the installer log report a 1603 error code (which by the way, doesn't really help much, as it means ERROR_INSTALL_FAILURE, that is a very generic "A fatal error occurred during installation.").
As the installation is still working on some other hosts on that very same platform, after further investigation we found out it was happening on hosts where Sql Server 2008 R2 was already installed, which leaded us to find out the issue is really with Windows Installer 4.5.
Whenever Windows Installer 4.5 was installed by an installer package, our installer package is failing with 1603. So far, we found as a work around: if we manually uninstall Windows Installer 4.5 (running something like "C:\WINDOWS\$NtUninstallKB942288-v4$\spuninst\spuninst.exe"), we can then run our installer package successfully, but this has various drawbacks:
the user who uninstall Windows Installer 4.5 is prompted with a dialog listing all the various software products installed using that, and effectively the link between those products and Windows Installer 4.5 is lost after uninstalling that, even if we reinstall it after successfully installing our application;
as Microsoft released various version of Windows Installer 4.5, the location of the utility to uninstall that is not strictly the one given above;
It is awkward to ask customers to perform such a work around.
I suppose upgrading the installer package to target Windows Installer 5 may solve the issue, but if possibile I would like to avoid it, and continuing to use InstallShield 2009 to author this specific package.
I have scoured the Microsoft and Flexera Knowledge Bases (and I am continuing my investigation), with no avail so far.
Does anyone knows if Microsoft or Flexera, or any other third party, have published an hotfix, or some further info, about this issue?
Some info about the 1603 error code failure
We got verbose logs for this issue, from at least 3 different servers, and we have investigated that in depth, to not avail so far. Most actions return 1, some 0 (specifically IsolateComponents, MigrateFeatureStates, IsolateComponents, SetODBCFolders, MigrateFeatureStates, UnpublishComponents, UnregisterComPlus, UnregisterTypeLibraries, UnregisterMIMEInfo, RemoveShortcuts, RemoveFiles, CreateShortcuts, RegisterMIMEInfo, InstallODBC, RegisterTypeLibraries, RegisterComPlus and PublishComponents, but nothing has yet came out investigating those), the installer package seems actually to be almost able to install (perform all the sequence down to "INSTALL. Return value 1.", it even prints "Product: [Our Product] -- Installation operation completed successfully."), only then it starts to rollback everything, and as there are various errors on the rollback, I think some of those will cause the 1603 (probably some 1607 returned by MsiProvideAssembly on ISChainPackagesCleanup), but the point is that it shouldn't rollback, and with Windows Installer 3.1 (or 5.x for that matter) it doesn't, it does rollback only when there is Windows Installer 4.5 installed on a Windows 2003 x86 environment.
Most likely your package has an action which fails, either custom or standard. Try creating a verbose log of the installation which fails (it's very important to be verbose). After the failure, open the log with a text editor and search for the error code (1603) to see what triggers it.
As a side note, don't try to blame Windows Installer. There's nothing wrong with version 4.5 and there are no hotfixes or something like that. The problem is in your package. It does something which is either incorrect or unsupported.
EDIT:
From your post update it looks like a failed chained installation. No errors are shown in the log because the error occurs in a different installer process.
If you are not using chained packages, try looking for errors in the Event Viewer.
If you are using chained packages, you can try enabling the Windows Installer logging policy and check for logs generated by them. Most likely one of the packages is encountering a problem.

Running Visual Studio with Elevated Privileges for Azure : any way to avoid the side effects?

I'm working on some Azure web apps, and in order to debug I'm running VS 2010 as Administrator (I normally right click the shortcut and run-as-admin, I'm aware that there are properties I can change or use Ctrl-Shift).
Windows Azure Tools for Microsoft Visual Studio - The Windows Azure compute emulator must be run elevated. Please restart VS in elevated administrator mode in order to run the project"
If I do this, Azure simulator works OK, but I get two other side effects.
1) I can't drag and drop onto the solution explorer. This is a pain. (Ctrl C/V works but I can't drop whole files into the solution explorer)
2) I develop inside of a DropBox file structure. If I've developed on my desktop, and grab my laptop, projects in my Azure solution that are created within, and shared with, other non-azure projects fail to load. Edit: If I develop outside of dropbox, zip a copy into dropbox, unzip that on the new machine, its all fine.
3) I get "Could not load file or assembly. Access is denied" for various DLL's used by the project - I can fix this for individual DLL's by giving permissions to Network Service but I get the error for resource files too and the same trick doesn't seem to work.
This interworking between machines works fine without elevated privileges - I've been doing it for 2 years on about 20 projects without issue.
So is there a way of running just the compute emulator elevated, or some other way of avoiding these side effects?
OS Version Win 7 Pro SP1 X64
Azure Tools for MSVS2010 Platform v1.4 (11/04/2011)
Windows Azure SDK (11/04/2011)
Windows Azure SDK 1.4.1 Refresh (11/04/2011)
Windows Azure AppFabric SDK V1.0 (29/06/2011)
Consistent over all machines
EDIT: Having already given Network Service user all permissions to the entire folder structure to the project, I get the following error. Prior to doing that, the error was similar, but was for access to the DLL's in the project's bin folder.
Parser Error Message: Access to the path 'C:\Users\ Beko2011Azure\Website\App_GlobalResources\EditorLocalization.uk-UA.resx' is denied.
Source Error: [No relevant source lines]
Source File: /App_GlobalResources/EditorLocalization.uk-UA.resx Line: 1
Version Information: Microsoft .NET Framework Version:4.0.30319;
As far as #1 goes, you can still CTRL+C and CTRL+V to the solution explorer. For everything else you described, the elevated priviliges are probably not the problem. This has especially nothing to do with Azure tools. I have them installed on several machines, and VS works elevated (I always use elevated mode because it's impossible to debug in IIS otherwise). I never had any problems with it.
The DLL/file access denied might be Dropbox's fault. Have you succesfully used this type of file structure in any other projects?
I have no idea what you meant by #2. What fails to load? Azure projects? And do you have the SDK installed on all machines? Same version? Did you mark a web site as hosted in IIS - this also prevents loading of projects.
Also, please update your post with: Operating system version, Azure SDK version...
Update: looking at your error message I can't help but wonder the problem is caused by Dropbox locking files that are needed, and these files then not being accessible by IIS when required. Could you try killing Dropbox service and checking to see if the application performs OK at that point?
As of Azure SDK 2.1 you no longer need to run the Emulator with Elevated privileges. See my answer here

Upgrading a Windows service unattended

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.

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