cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Smatchimo
Level 3

.NET service fails to install

I'm trying to set up a fairly simple InstallScript MSI package to install a .NET 2.0 service. However the service fails to install, yet no error messages are given.

I can manually call installutil.exe on the main .exe and it installs fine. I made some custom functions to call InstallUtil manually to install/uninstall but I'm trying to do this the proper way and make InstallShield take care of the service itself.

This project contains 3 components/folders all part of a single Feature:
1) [INSTALLDIR] = one .exe (key file) and one .config file
2) [INSTALLDIR]config subfolder = a few more config files
3) [INSTALLDIR]script subfolder = a few more example files that have no impact on the service.

Screenshot of the component configuration is attached below.

(the .NET Installer Class Arguments are set to the default, no special arguments are needed by the installer class, I tried specifying a logfile but it wasn't created so I set it back to the default "/LogFile=" setting for all the phases.)

I also followed this guide http://kb.acresso.com/selfservice/microsites/search.do?cmd=displayKC&docType=kc&externalId=Q108690&sliceId= (This is just a plain .NET service .exe, not a merge module though). I set up _ISSupportedRuntimes listing 2.0.50727 only, and its creating _isconfig.xml ok when building. I also set up that custom VSDFxConfigFile action like that article describes although when I try to add it as the service install/execute action, it always ends up being the 2nd one, just below ISSetupFilesExtract.

Also under that same component's Install NT Services, I added the service there, with the default settings. (I actually tried removing this but it made no differnece)

So, all the files from the 3 components install just fine but no service is created and no errors are given. Not quite sure where to start troubleshooting. I tried enabling MSI logging but since this is an Installshield MSI project I can't msiexec the setup.exe.

Thanks for any assistance!
Labels (1)
0 Kudos
(10) Replies
mayurbirari
Level 5

It is very simple to add a windows service.
Follow these steps -
1) Right click on the components.
2) Right Click on the component wizard.
3) Then select 2nd Options i.e. Let me select and define my component.
4) Then next select Install as NT Service.
5) Then next select executable. Add a service by clicking Add Service button.
6) Then click Next and complete the wizard.

That should do it.
0 Kudos
Christopher_Pai
Level 16

Typically you find problems trying to start the service, not create it. The creation is usually easy ( define a service for the component that has a keyfile which is the exe that implements the service base class ).

The troubles from trying to start it are usually resolved through profiling the dependencies and any runtime exceptions while the installer is on the error dialog saying it couldn't be started.

If you want to send me your ISM I can look at it but I'm sure whatever the problem is, it's a simple oversight.
0 Kudos
DebbieL
Level 17

To log an InstallScript MSI installation, try this command line:
Setup.exe /v"/l*v c:\MyLogFile.log"
0 Kudos
Smatchimo
Level 3

Here are a few specific questions I still have, besides the more general "why isn't this working??" 🙂

1) The manual says that for installing a normal service, the component should just have a single file, the .exe ... In this case since it's a .NET service which needs both an .exe and an .exe.config file, is it ok to put the .exe.config as part of the same component, or does it need to be in a separate component even though it's going into the same location?

2) Do you need to set up the "Install NT Services" and "Control NT Services" settings when it's a .NET service trying to use the .NET installer class? Not quite sure if those are only for 'normal' services or if .NET services need them too, especially the "Install NT Service" one.



Would anyone care to check out this project to see what I'm doing wrong? I'm just trying to repackage some open source software so I can freely give out the files. I'm having to go back to the uglier "manually call installutil.exe" method for now as I'm out of ideas on how to get this working.

p.s. in my Tools / Options / .NET settings I do have it pointed at the .NET 2.0 files correctly as well, i.e. c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtilLib.dll

InstallShield MSI project: http://204.118.41.9/tmp/ncnet/NC_NET.ism
Raw files: http://204.118.41.9/tmp/ncnet/files.zip
Install log: http://204.118.41.9/tmp/ncnet/MyLogFile.log
Build: http://204.118.41.9/tmp/ncnet/NC_Net_v4.4.0_GSI.exe

The files above have both Install NT Services and Control NT Services configured, although I changed all the options to 'no' under Control NT Services so it doesn't give a warning due to the NC_NET service not existing, since it's still not getting installed right.

Playing with installutil.exe, I can place the NC_NET.exe all by itself and installutil installs the service just fine, it doesn't even need the NC_NET.exe.config or the config subfolder.

So far not much custom InstallScripting has been done other than to skip a few unnecessary dialogs since this package will mainly be pushed out using silent installs. The only slightly weird thing I've changed is set the INSTALLDIR default to be [WindowsVolume]gsi-tools\NC_NET to try and install into C:\gsi-tools\ by default instead of C:\Program Files\, but I think that's working fine since all the files end up in the right location, it's only the service which is MIA. The keyfile for the component is set to [INSTALLDIR]NC_Net.exe so it should be able to find it just fine I'd think.

Looking through the install log the only thing weird I noticed was the InstallServices action is running before I see the FileCopy's which appear to be part of the InstallFinalize action. Maybe that's why the service fails to install, the .exe doesn't exist yet in the right location when it's trying to install it? Not finding 'error' or 'fail' etc in the log anywhere though, so I'm not sure if InstallShield's automagic .NET Installer Class service installing actually makes use of the InstallServices MSI action.
0 Kudos
Christopher_Pai
Level 16

Read:

http://blog.deploymentengineering.com/2006/07/msi-vs-net.html

The config file can be a companion file to the exe, but the exe must be the keyfile of the component because thats what the serviceinstall table does a foreign key join to. You do not need, nor want to use, the Installer class CA.

I'll look at your ISM in a few minutes
0 Kudos
Christopher_Pai
Level 16

In your ISM, in the NC_Net component, NC_Net.exe is not marked as the keyfile of the component.

Refer to:

http://msdn.microsoft.com/en-us/library/aa371637(VS.85).aspx

Component_ column ( _ indicates joins to a table by the same name where the primary key is also the same name: Component.Component )

"Component_
External key to column one of the Component Table. Note that to install this service using the InstallService table, the KeyPath for this component must be the executable file for the service."
0 Kudos
Smatchimo
Level 3

Thanks for the responses!

I thought setting the Key File just meant setting the '.NET Application File' field, didn't realize there was more to it than that, I'll have to give that a shot tomorrow.

I seem to be missing something in that blog entry you linked. What should I be paying attention to there, just the fact that it's ok to install .NET applications as normal services and not bother doing the whole installutil / managed install thing? The XCOPY link seems to be a dead page, maybe that's the problem? (http://www.installshield.com/news/newsletter/0403-articles/installer.asp)

Thanks again!
0 Kudos
Christopher_Pai
Level 16

You got the concept, it's ok (best) not to use InstallUtil/Installer class.

Under component, under files, right click your EXE and select Set Key File.

Components and Key Files is an extremely important MSI concept to learn. I dare say it's the most important.
0 Kudos
Justine
Level 2

I also have a .NET service that I would like to install without using a Custom Action and InstallUtil (which is what I have working now).

I see the manual states that the service must be an EXE. My service is made up of an EXE (that has an installer class) and the class derived from ServiceBase refers to additional classes in several private assemblies.

Can I install a service like this? The manual is making it seem as you cant.

Thanks for any information you could provide.
0 Kudos
Christopher_Pai
Level 16

0 Kudos