PC Review


Reply
Thread Tools Rate Thread

Unable to retrieve service name of VB.Net service after service st

 
 
=?Utf-8?B?VG9t?=
Guest
Posts: n/a
 
      20th Jan 2006
Hi Friends

I write a VB.net windows service (Service start periodically according a
Timer object) and install it using InstallUtil. The service start when the
Timer is enabled. Since I have requirement to start multiple instances of the
service using the sameSAME assembly on the same machine, I use install script
to install the service (using InstallUtil). I override the OnBeforeInstall,
OnBeforeUninstall, Install and Uninstall methods of Installer class so that I
can change the service name for each instances of service installed according
to that specified in Install script. This works and I m able to see several
services with different names but running on the same executable. However, I
have some configuration that need to be retrieved for EACH service instance
(i.e. Different config for difficult service instance). I write the
configuration to the registry for that service (This also works since the
registry has some key entry for EACH service name). However, problem comes:
I was unable to retrieve service name of each service instance. For example,
in the script I install 2 services called S1 and S2. The two services can
successfully be registered and started with the name S1 and S2. However, when
I attach the executable process (after the services have been started) to
VS.NET and examine the Me.ServiceName (and event source) field in my
executable (which inherits System.ServiceProcess.ServiceBase), it is Service1
instead of S1 or S2!! I read many articles from MSDN and it says I should set
this service name property to that I specify in serviceInstaller (which is S1
and S2 in this case), but the problem is that in my executable I only know
the service name in RUN TIME and I m unable to hardcode the service name to
the field. So I would like to know are there any ways for me to retrieve the
service name of the current executing service from my executable, which
inherits System.ServiceProcess.ServiceBase?

Many Thanks In advance and any help is highly appreciated!!!!!!!!

Tom
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I reveerse name order last name, first name to first name, last name Don Smith Microsoft Excel Discussion 9 29th Nov 2006 10:55 PM
Network adepter instalation problem - The name is already in use as a service name or service display name Boaz Raufman Windows XP Hardware 2 24th Jul 2005 09:26 AM
Network adepter instalation problem - The name is already in use as a service name or service display name Boaz Raufman Windows XP Networking 0 20th Jul 2005 05:01 PM
Error: Name is already in use as a service name or as service display name Alison Chase Windows XP Networking 2 20th Jan 2005 11:50 PM
error: name is already in use as either a service name or a service display name ksmall1@us.ibm.com Microsoft Windows 2000 Upgrade 0 18th Jan 2004 06:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:25 PM.