[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 323
  • Last Modified:

.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".  
0
carlkelley
Asked:
carlkelley
  • 7
  • 3
  • 2
1 Solution
 
carlkelleyAuthor Commented:
+ .NET Framework v2.0.50727 is installed
+  I got the same result when I installed it under Win2K3SP2 Web Edition inside VMWare Server.
0
 
surajgupthaCommented:
>>  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?
0
 
carlkelleyAuthor Commented:
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.  
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
surajgupthaCommented:
In the machine where it doesnt appear can you check to see if the folder/files for the service have been created and copied?
0
 
carlkelleyAuthor Commented:
I will get back to you with an answer in about 10 hours.
0
 
grsychcknCommented:
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.Install.Installer[] { this.serviceInstaller, this.serviceProcessInstaller } );".

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.
0
 
grsychcknCommented:
I just re-read your comment above that the service appears for some machines and not others.  You might try to manually register the service on those machines just to see if you get an error during the registration process.

Open a reguar command prompt and browse to your .Net framework 2.0 directory (typically "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727") and run installutil from there with the full path to your service's exe.  If the registration fails, you'll see in the prompt that the install was rolled back and it should give you some helpful info if it failed.
0
 
carlkelleyAuthor Commented:
The install did create the expected directory on the target Win23KR2x64 server: c:\Program Files(x86)\MyCorp\Optimizer 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.IContainer 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.Container();

            this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
            this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();

            this.serviceInstaller1.DisplayName = "Optimizer";
            this.serviceInstaller1.ServiceName = "Optimizer";

            this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic;

            this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
            this.serviceProcessInstaller1.Password = null;
            this.serviceProcessInstaller1.Username = 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.MSDNVS/cpref/html/frlrfSystemConfigurationInstallInstallerClassInstallersTopic.htm).
            this.Installers.AddRange(new System.Configuration.Install.Installer[] {this.serviceProcessInstaller1,
                                                                                    this.serviceInstaller1});
        }

        #endregion
    }
}
0
 
carlkelleyAuthor Commented:
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?
0
 
carlkelleyAuthor Commented:
Here is the output from installutil.exe:
----------------------------------------------------------------------------------------------
C:\Program Files (x86)\MyCorp\Optimizer>c:\windows\microsoft.net\framework\v2.0.50727\installutil.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\optimizerservice.exe assembly's progress.
The file is located at C:\Program Files (x86)\MyCorp\Optimizer\optimizerservice.InstallLog.
Installing assembly 'C:\Program Files (x86)\MyCorp\Optimizer\optimizerservice.exe'.
Affected parameters are:
   logtoconsole =
   assemblypath = C:\Program Files (x86)\MyCorp\Optimizer\optimizerservice.exe
   logfile = C:\Program Files (x86)\MyCorp\Optimizer\optimizerservice.InstallLog
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\optimizerservice.exe assembly's progress.
The file is located at C:\Program Files (x86)\MyCorp\Optimizer\optimizerservice.InstallLog.
Committing assembly 'C:\Program Files (x86)\MyCorp\Optimizer\optimizerservice.exe'.
Affected parameters are:
   logtoconsole =
   assemblypath = C:\Program Files (x86)\MyCorp\Optimizer\optimizerservice.exe
   logfile = C:\Program Files (x86)\MyCorp\Optimizer\optimizerservice.InstallLog

The Commit phase completed successfully.

The transacted install has completed.
0
 
grsychcknCommented:
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?
0
 
carlkelleyAuthor Commented:
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.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 7
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now