carlkelley
asked on
.NET 2.0 Service appears to install successfully but is not listed in Win2K3 Services
I have developed an x32 .NET 2.0 Service and a .NET 2.0 deployment project to install it. The services appears to install, but does not appear in the Windows Services control panel. As a result, it can't be started or stopped. Unfortunately, I can find no error messages.
Here are some clues:
+ The installer has run successfully on my Windows XP, Win2K server and a client's Win2K3 server.
+ It also appeared to run fine on my new Win2K3R2x64 box.
+ The Application event log sayes that it successfully installed.
+ The service is represented in the Control Panels "Add/Remove Programs".
Here are some clues:
+ The installer has run successfully on my Windows XP, Win2K server and a client's Win2K3 server.
+ It also appeared to run fine on my new Win2K3R2x64 box.
+ The Application event log sayes that it successfully installed.
+ The service is represented in the Control Panels "Add/Remove Programs".
>> It also appeared to run fine on my new Win2K3R2x64 box.
Does that mean that the same installer when installed on this box shows up on the list of services but doesnt show on the machine you are trying to run it on now? what OS does this machine have?
>> The installer has run successfully on my Windows XP, Win2K server and a client's Win2K3 server.
In the machine where it doesnt appear can you check to see if the folder/files for the service have been created and copied?
Does that mean that the same installer when installed on this box shows up on the list of services but doesnt show on the machine you are trying to run it on now? what OS does this machine have?
>> The installer has run successfully on my Windows XP, Win2K server and a client's Win2K3 server.
In the machine where it doesnt appear can you check to see if the folder/files for the service have been created and copied?
ASKER
The installer has run successfully on my Windows XPSP2, Win2KSP4 server and a client's Win2K3SP? server such that the installed service appears in the list of services. The installer appears to be successful on my new Win2K3R2x64, but it does not appear in the list of services. The installer also appears to be successful on Win2K3SP2x32 Web Edition running inside VMWare server on the Win2K3R2x64 server, but it does not appear in the Win2K3SP2WEx32 list of services.
In the machine where it doesnt appear can you check to see if the folder/files for the service have been created and copied?
ASKER
I will get back to you with an answer in about 10 hours.
I assume you're using a MSI (Microsoft setup project) to install your service.
Inside your service project, you need to add a new ProjectInstaller class. From your toolbox you need to add serviceInstaller and serviceProcessInstaller objects. Using the designer you should click on each object and modify the properties to reflect your particular service. Using VS 2005, you should expand the ProjectInstaller.Designer. cs and check your InitializeComponent method. Here it should call "this.Installers.AddRange( new System.Configuration.Insta ll.Install er[] { this.serviceInstaller, this.serviceProcessInstall er } );".
That will allow your service to be seen by the setup project as a service that can be installed as such. Right click your setup project, go to view, custom actions and add the output from your service project to each custom action stage (install, commit, rollback, uninstall). This will make the installer register your exe as a service in the Service Control Manager.
If you want to manually register your service, you still need to create a ProjectInstaller in your service project. You then open up a VS command prompt (for path reasons) and browse to your service's installed directory (e.g. C:\Program Files\MyCompany\MyService) . To register your service, you type "installutil myservice.exe". To un-register your service, you type "installutil -u myservice.exe".
Hope this helps.
Inside your service project, you need to add a new ProjectInstaller class. From your toolbox you need to add serviceInstaller and serviceProcessInstaller objects. Using the designer you should click on each object and modify the properties to reflect your particular service. Using VS 2005, you should expand the ProjectInstaller.Designer.
That will allow your service to be seen by the setup project as a service that can be installed as such. Right click your setup project, go to view, custom actions and add the output from your service project to each custom action stage (install, commit, rollback, uninstall). This will make the installer register your exe as a service in the Service Control Manager.
If you want to manually register your service, you still need to create a ProjectInstaller in your service project. You then open up a VS command prompt (for path reasons) and browse to your service's installed directory (e.g. C:\Program Files\MyCompany\MyService)
Hope this helps.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The install did create the expected directory on the target Win23KR2x64 server: c:\Program Files(x86)\MyCorp\Optimize r and inside all the expected files were also created.
/*------------------------ ---------- ---------- ---------- ---------- ---------- ---------- ------*/
The VS.NET 2005 project already seems to include the code that you suggest:
namespace OptimizerService
{
partial class ServiceInstaller
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.ICon tainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Cont ainer();
this.serviceInstaller1 = new System.ServiceProcess.Serv iceInstall er();
this.serviceProcessInstall er1 = new System.ServiceProcess.Serv iceProcess Installer( );
this.serviceInstaller1.Dis playName = "Optimizer";
this.serviceInstaller1.Ser viceName = "Optimizer";
this.serviceInstaller1.Sta rtType = System.ServiceProcess.Serv iceStartMo de.Automat ic;
this.serviceProcessInstall er1.Accoun t = System.ServiceProcess.Serv iceAccount .LocalSyst em;
this.serviceProcessInstall er1.Passwo rd = null;
this.serviceProcessInstall er1.Userna me = null;
// This binds the ServiceProcessInstaller, along with our ServiceInstaller, into our Installers.
// Installers are inherited from our derived class.
// Again, if you want more information on this, please consult the documentation
// (ms-help://MS.VSCC/MS.MSDN VS/cpref/h tml/frlrfS ystemConfi gurationIn stallInsta llerClassI nstallersT opic.htm).
this.Installers.AddRange(n ew System.Configuration.Insta ll.Install er[] {this.serviceProcessInstal ler1,
this.serviceInstaller1});
}
#endregion
}
}
/*------------------------
The VS.NET 2005 project already seems to include the code that you suggest:
namespace OptimizerService
{
partial class ServiceInstaller
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.ICon
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Cont
this.serviceInstaller1 = new System.ServiceProcess.Serv
this.serviceProcessInstall
this.serviceInstaller1.Dis
this.serviceInstaller1.Ser
this.serviceInstaller1.Sta
this.serviceProcessInstall
this.serviceProcessInstall
this.serviceProcessInstall
// This binds the ServiceProcessInstaller, along with our ServiceInstaller, into our Installers.
// Installers are inherited from our derived class.
// Again, if you want more information on this, please consult the documentation
// (ms-help://MS.VSCC/MS.MSDN
this.Installers.AddRange(n
this.serviceInstaller1});
}
#endregion
}
}
ASKER
I took your advice and ran the x32 InstallUtil.exe. Immediately thereafter, it was visible in the Win2K3R2x64 list of services. I then started from the services list and the event viewer reported that the service was started successfully.
To get installutil.exe to invoke, I had to provide its full path name. Both the x32 and x64 versions of the .NET 2.0 Framework are installed on the system. Could this explain why the msi intaller failed to complete its work?
To get installutil.exe to invoke, I had to provide its full path name. Both the x32 and x64 versions of the .NET 2.0 Framework are installed on the system. Could this explain why the msi intaller failed to complete its work?
ASKER
Here is the output from installutil.exe:
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- --------
C:\Program Files (x86)\MyCorp\Optimizer>c:\ windows\mi crosoft.ne t\framewor k\v2.0.507 27\install util.exe optimizerservice.exe
Microsoft (R) .NET Framework Installation utility Version 2.0.50727.832
Copyright (c) Microsoft Corporation. All rights reserved.
Running a transacted installation.
Beginning the Install phase of the installation.
See the contents of the log file for the C:\Program Files (x86)\MyCorp\Optimizer\opt imizerserv ice.exe assembly's progress.
The file is located at C:\Program Files (x86)\MyCorp\Optimizer\opt imizerserv ice.Instal lLog.
Installing assembly 'C:\Program Files (x86)\MyCorp\Optimizer\opt imizerserv ice.exe'.
Affected parameters are:
logtoconsole =
assemblypath = C:\Program Files (x86)\MyCorp\Optimizer\opt imizerserv ice.exe
logfile = C:\Program Files (x86)\MyCorp\Optimizer\opt imizerserv ice.Instal lLog
Installing service Optimizer...
Service Optimizer has been successfully installed.
Creating EventLog source Optimizer in log Application...
The Install phase completed successfully, and the Commit phase is beginning.
See the contents of the log file for the C:\Program Files (x86)\MyCorp\Optimizer\opt imizerserv ice.exe assembly's progress.
The file is located at C:\Program Files (x86)\MyCorp\Optimizer\opt imizerserv ice.Instal lLog.
Committing assembly 'C:\Program Files (x86)\MyCorp\Optimizer\opt imizerserv ice.exe'.
Affected parameters are:
logtoconsole =
assemblypath = C:\Program Files (x86)\MyCorp\Optimizer\opt imizerserv ice.exe
logfile = C:\Program Files (x86)\MyCorp\Optimizer\opt imizerserv ice.Instal lLog
The Commit phase completed successfully.
The transacted install has completed.
--------------------------
C:\Program Files (x86)\MyCorp\Optimizer>c:\
Microsoft (R) .NET Framework Installation utility Version 2.0.50727.832
Copyright (c) Microsoft Corporation. All rights reserved.
Running a transacted installation.
Beginning the Install phase of the installation.
See the contents of the log file for the C:\Program Files (x86)\MyCorp\Optimizer\opt
The file is located at C:\Program Files (x86)\MyCorp\Optimizer\opt
Installing assembly 'C:\Program Files (x86)\MyCorp\Optimizer\opt
Affected parameters are:
logtoconsole =
assemblypath = C:\Program Files (x86)\MyCorp\Optimizer\opt
logfile = C:\Program Files (x86)\MyCorp\Optimizer\opt
Installing service Optimizer...
Service Optimizer has been successfully installed.
Creating EventLog source Optimizer in log Application...
The Install phase completed successfully, and the Commit phase is beginning.
See the contents of the log file for the C:\Program Files (x86)\MyCorp\Optimizer\opt
The file is located at C:\Program Files (x86)\MyCorp\Optimizer\opt
Committing assembly 'C:\Program Files (x86)\MyCorp\Optimizer\opt
Affected parameters are:
logtoconsole =
assemblypath = C:\Program Files (x86)\MyCorp\Optimizer\opt
logfile = C:\Program Files (x86)\MyCorp\Optimizer\opt
The Commit phase completed successfully.
The transacted install has completed.
I can't rule it out, but I've installed multiple x32 services on x64 machines without problems using MSI's.
I don't think you said if you were using a "Setup Project" in VS 2005, if so can you confirm you've added your custom actions for your service?
When you run the setup, it registers the service correctly in the SCM on other machines without the use of installutil?
Are you installing the service under a different user account than the one you are logged in as (Permissions issue perhaps)?
Do you have an InstallLog file created when it fails and what are the contents?
I don't think you said if you were using a "Setup Project" in VS 2005, if so can you confirm you've added your custom actions for your service?
When you run the setup, it registers the service correctly in the SCM on other machines without the use of installutil?
Are you installing the service under a different user account than the one you are logged in as (Permissions issue perhaps)?
Do you have an InstallLog file created when it fails and what are the contents?
ASKER
I researched my notes and I have always had to run installutil.exe the first time that I have installed the service. It has been so long that I forgot about it. When I said that it had run successfully on other machines without problem, what I was really saying is that it installed properly after the first time. I posted the InstallLog file above your request.
ASKER
+ I got the same result when I installed it under Win2K3SP2 Web Edition inside VMWare Server.