473,396 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Creating a service

I see in the examples at MSDN that when a
service is created, Main method is still
there, as the code below shows. Why is it
there?! I'd expect OnStart to be the only
required entry point for a service.

public static void Main() {
System.ServiceProcess.
ServiceBase.Run(new UserService1());}
--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.
Sep 3 '08 #1
4 1069
"K Viltersten" <tm**@viltersten.comwrote in message
news:6i************@mid.individual.net...
>I see in the examples at MSDN that when a
service is created, Main method is still
there, as the code below shows. Why is it
there?! I'd expect OnStart to be the only
required entry point for a service.
A service application is still a Windows .exe, and as such its entry point
is Main. It actually becomes a service process only after it registers
itself with the Service Control Manager, which is what ServiceBase.Run does.
Sep 3 '08 #2
Got it, thanks.

In that case, i wonder why i need to
install the service. If the registration
is done in Main, it seems superfluous to
to that using installutil.exe as well.

What do i miss?

--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.
"Pavel Minaev" <in****@gmail.comskrev i meddelandet
news:O0**************@TK2MSFTNGP04.phx.gbl...
"K Viltersten" <tm**@viltersten.comwrote in message
news:6i************@mid.individual.net...
>>I see in the examples at MSDN that when a
service is created, Main method is still
there, as the code below shows. Why is it
there?! I'd expect OnStart to be the only
required entry point for a service.

A service application is still a Windows .exe, and as such its entry point
is Main. It actually becomes a service process only after it registers
itself with the Service Control Manager, which is what ServiceBase.Run
does.

Sep 3 '08 #3
"K Viltersten" <tm**@viltersten.comwrote in message
news:6i************@mid.individual.net...
Got it, thanks.

In that case, i wonder why i need to
install the service. If the registration
is done in Main, it seems superfluous to
to that using installutil.exe as well.

What do i miss?
Registration of the specific running _process_ as a service is done in Main,
not of the executable. You still need to register the executable for it to
appear in the list of services.
Sep 3 '08 #4
>Got it, thanks.
>>
In that case, i wonder why i need to
install the service. If the registration
is done in Main, it seems superfluous to
to that using installutil.exe as well.

What do i miss?

Registration of the specific running _process_ as a service is done in
Main, not of the executable. You still need to register the executable for
it to appear in the list of services.
Got it, thanks!

Hey, how come my post went top-posted?!
It was unintentional, sorry...

--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.
Sep 3 '08 #5

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

Similar topics

3
by: BobHutch | last post by:
I am trying to create a windows service using vb.net to read a sql table every half hour and copy all new records created within each half hour increment to another table. I also want to be able...
9
by: Opa | last post by:
When creating a new web service, I get the following error: Visual Studio .net cannot create or open the application. Web site 'http://localhost/WDWS' not started. The World Wide Web Publish...
2
by: Val3 | last post by:
Hi all. I need to build dll(s) and windows services using VB .NET 2005 Express. When I make File/New project the windows contain only Windows application, Windows control library, Console...
4
by: SH | last post by:
I wish to create a program (really a Windows Service) that sits and waits for a client PC to communicate with it, but I can't come up with a good method of doing so. I want to have a service...
2
by: pshvarts | last post by:
(I'm new in SOAP) I get some wsdl file (from apache service ). I tried creating SOAP client with .NET - trying to add Web Reference and get error like: "Custom tool error: Unable to import...
3
by: clsmith66 | last post by:
I hope this is just something stupid I'm missing and someone can easily point out my error. I'm trying to do a few turorials on windows services, and the couple I found so far just create an event...
16
by: tshad | last post by:
This is a little complicated to explain but I have some web services on a machine that work great. The problem is that I have run into a situation where I need to set up my program to access one...
1
by: =?Utf-8?B?cm9zczYxMw==?= | last post by:
I'm puzzled by an error message encountered while creating a Windows Service. In particular, I'm creating a second Windows Service within a Windows Service project, using Visual Studio 2005. The...
2
by: teejayem | last post by:
I am having problems creating a Windows Service using Visual Studio 2005. Code as follows:- Imports System.IO Imports System.Net.Mail
2
by: Bert Leu | last post by:
Hi I understand, that the "normal way" in creating Web Services is: Creating Web Service -- WSDL -- Creating Client Unfortunately, I have to create a Web Service (Service, not Clinet) from...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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,...

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.