Windows Service Project



I posted these on another group, but was redirected here, so here are my two posts and my questions:

Post #1:

I've started my first practice windows service project in C#, and I'm already
stuck.

Let's say I'm trying to make a simple service (and useless, but good for
practice). It is supposed to listen on port which is stored in its configuration
file (say C:\MyService\Config.CFG). After it receives something (anything), then
it is supposed to open a file C:\MyService\File.TXT, read the number that is
written in it, increase it by 1, save it, send it to the application that
originally sent the query, close the file and wait for further queries.

In the above, there are three key moments which prevent me from programming such
a service:
1. How do I make the service listen on any port?
2. What is the event that is raised (or what do I need to do), when some query
actually arrives at that port?
3. How do I make the service send the response to an application which made the
query?

If necessary and if you can, disregard the existing standard communication
protocols, as I will be programming the client side too, so I suppose it doesn't
matter what's the format of my response.

The client, however, is another problem:
How do I make another program (I am programming it) send the query to the port
on which my service is listening, and how does it read the response?

Post #2:

While the above still isn't clear, I was using the documentation to create a
service, and put it on my services list. I've followed the tutorial
"Walkthrough: Creating a Windows Service Application in the Component Designer"
to the letter. I've installed the service and it appeared on my available
services list.

However, it failed to start. Event log only contained the following message:

Service cannot be started. The service process could not connect to the service
controller

What am I doing wrong?

Thanks,
Nikola

--
"It is easy in the world to live after the world's opinion; it easy in solitude to live after our own; but the great man is he who in the midst of the crowd keeps with perfect sweetness the independence of solitude."
Ralph Waldo Emerson, Self-reliance 1841
http://pinpoint.wordpress.com/

.



Relevant Pages

  • Services, C#
    ... I've started my first practice windows service project in C#, ... How do I make the service listen on any port? ... What is the event that is raised, when some query actually arrives at that port? ... If necessary and if you can, disregard the existing standard communication protocols, as I will be programming the client side too, so I suppose it doesn't matter what's the format of my response. ...
    (microsoft.public.dotnet.languages.vc)
  • Services, C#
    ... How do I make the service listen on any port? ... What is the event that is raised, when some query actually arrives at that port? ... If necessary and if you can, disregard the existing standard communication protocols, as I will be programming the client side too, so I suppose it doesn't matter what's the format of my response. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Windows Service Project
    ... You could also go something that it is not listening by ... originally sent the query, close the file and wait for further queries. ... How do I make the service listen on any port? ... protocols, as I will be programming the client side too, so I suppose it ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Whose Fish?
    ... OO can write the same apps with the same ... My view of how I query info may be different than even what ANOTHER ... Most programming language frameworks are OO, ... In-App composition & aggregation, ...
    (comp.object)
  • RE: MBSA and MSs attempts at "security"
    ... >the port status of TCP and UDP ports on a computer you choose. ... you can also query an LDAP service. ... LDAP query and interpret an LDAP server's response to ...
    (Focus-Microsoft)