473,804 Members | 2,255 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System Service - One assembly, two services

Hello,

I wrote a system service, whis is located in assembly called "s1.exe". But i
like to install this service twice. Problem starts, when service starts....a
service code loks like this:

public class TestService : ServiceBase
{
public TestService(str ing serviceName)
{
this.ServiceNam e = "????";
}

protected override void Dispose(bool disposing)
{
base.Dispose(di sposing);
}

ServiceThread serviceClass;

protected override void OnStart(string[] args)
{
serviceClass = new ServiceThread(p aram);
}

protected override void OnStop()
{
if(serviceClass !=null)
serviceClass.St op();
serviceClass = null;
}

public static void Main(string[] Args)
{
System.ServiceP rocess.ServiceB ase.Run(new
System.ServiceP rocess.ServiceB ase[] {new TestService(par am)});
}
}

But there is one problem....how to make service know, what service name
should it have?
I've tried to use command line arguments, but i'm not unable to to pass this
(except the situation, when i start service manually...)

regards,
Pawel Janik
Nov 16 '05 #1
6 1394
"Pawel Janik" <ja***@poczta.g azeta.pl> wrote in
news:c8******** **@inews.gazeta .pl:
But there is one problem....how to make service know, what service name
should it have?


When a service is installed it is queried for its name. Its during
instalation you need to specify a different name.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"

Make your ASP.NET applications run faster
http://www.atozed.com/IntraWeb/
Nov 16 '05 #2
> > But there is one problem....how to make service know, what service name
should it have?


When a service is installed it is queried for its name. Its during
instalation you need to specify a different name.

Yes, you have right, so i was able to install it twice.

In previous post i pasted a system service code, that is not executed during
installation, but while starting service...and in this place i also need a
service name!
Or i am wrong? coud you point me to a very simple example of a service
class?

regards,
Pawel Janik
Nov 16 '05 #3
"Pawel Janik" <ja***@poczta.g azeta.pl> wrote in
news:c8******** **@inews.gazeta .pl:
In previous post i pasted a system service code, that is not executed
during installation, but while starting service...and in this place i
also need a service name!
You cannot specify it at start up. You have to specify it at installation -
it goes into the registry. Each services supports -install, and thats when
you specify it.
Or i am wrong? coud you point me to a very simple example of a service
class?


I've not done it in C#, so I dont have code handy that would be of use to
you.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"

Empower ASP.NET with IntraWeb
http://www.atozed.com/IntraWeb/
Nov 16 '05 #4
> > In previous post i pasted a system service code, that is not executed
during installation, but while starting service...and in this place i
also need a service name!
You cannot specify it at start up. You have to specify it at

installation - it goes into the registry. Each services supports -install, and thats when
you specify it.
Or i am wrong? coud you point me to a very simple example of a service
class?


I've not done it in C#, so I dont have code handy that would be of use to
you.

It cou'd be a example in any .net language...it's not a problem to me...

but i'm still quite sure, that you have to put a service name while
starting...lets se an example:
http://www.theserverside.net/article...?id=Automation

Ant there, in system service code, stands a line:
Private Sub InitializeCompo nent()
components = New System.Componen tModel.Containe r()
Me.ServiceName = "FTPWatch" '(1c)Change to FTPwatch Here
End Sub

ommiting this line goes to troubles while starting service.....

regards,
Pawel Janik
Nov 16 '05 #5
> > > In previous post i pasted a system service code, that is not executed
during installation, but while starting service...and in this place i
also need a service name!


You cannot specify it at start up. You have to specify it at

installation -
it goes into the registry. Each services supports -install, and thats when you specify it.
Or i am wrong? coud you point me to a very simple example of a service
class?


I've not done it in C#, so I dont have code handy that would be of use to you.

It cou'd be a example in any .net language...it's not a problem to me...

but i'm still quite sure, that you have to put a service name while
starting...lets se an example:
http://www.theserverside.net/article...?id=Automation

Ant there, in system service code, stands a line:
Private Sub InitializeCompo nent()
components = New System.Componen tModel.Containe r()
Me.ServiceName = "FTPWatch" '(1c)Change to FTPwatch Here
End Sub

ommiting this line goes to troubles while starting service.....

sorry....my mistake....
i did not try setting service name...it works....;)

but there i have another problem...how to get my service name? ;)..a
ServiceBase.Ser viceName property is empty :(

regards,
Pawel Janik
Nov 16 '05 #6
"Pawel Janik" <ja***@poczta.g azeta.pl> wrote in news:c8hm0i$fbl $1
@inews.gazeta.p l:
It cou'd be a example in any .net language...it's not a problem to me...


Except the last service I built was in Win32 - so I dont think the code would
help you. :)
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"

Make your ASP.NET applications run faster
http://www.atozed.com/IntraWeb/
Nov 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2746
by: Scott Reynolds | last post by:
I am having a problem exposing a class inherited from the collection base class as a webservice. If I expose the collection on a web page all works well and I am very happy. However when I try and expose this via a web service I get a weird error saying that the dll could not be found. The specific error is: I can't figure it out. I thought it was to do with reflection but I am able to load and view the webservice definition which...
3
5006
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : >************************************************************************ > <WebMethod(), System.Web.Services.Protocols.SoapRpcMethod()> _ > Public Function HelloWorld() As > <System.Xml.Serialization.SoapElementAttribute("return")> String
0
755
by: Kirk | last post by:
I'm trying to use a Web Service to be a Remoting client of an existing ..NET 2.0 server. But I get the following error when I try to use System.Runtime.Remoting.Channels.Http in my WebService. The same code works fine in a standalone app. I have inspected System.Runtime.Remoting.dll with ildasm, and I can see the ....Channels.Http namespace there. I verified that the virtual directory is configured to use v2.0.50727 (the error message...
2
3702
by: Kirk | last post by:
I'm trying to use a Web Service to be a Remoting client of an existing ..NET 2.0 server. But I get the following error when I try to use System.Runtime.Remoting.Channels.Http in my WebService. The same code works fine in a standalone app. I have inspected System.Runtime.Remoting.dll with ildasm, and I can see the ....Channels.Http namespace there. I verified that the virtual directory is configured to use v2.0.50727 (the error message...
1
2631
by: Mongo | last post by:
I am getting the following error when I try to run a new webservice I have placed on any one of 4 windows 2003 servers. (Running under ASP.NET 1.1) To minimize the problem, I created a simple webservice called "TestApp" that exposes as the lone method on the service. I create a simple installer package for the msi and run it on the server. When I go to http://.../TestApp/Service1.asmx, the generated page and test page appear fine. ...
0
9714
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10347
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10090
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9173
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7635
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6863
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3832
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.