473,486 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Services, C#

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?

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/

Jan 23 '07 #1
5 2945
This isn't a reply, I've only added one more question at the end.

"Sourcerer" <en****@MAKNIgmail.comwrote in message
news:ep**********@ss408.t-com.hr...
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?
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?

--
"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/

Jan 24 '07 #2
"Sourcerer" <en****@MAKNIgmail.comwrote in message
news:ep**********@ss408.t-com.hr...
I've started my first practice windows service project in C#, and I'm
already stuck.
You may get a response here, but as this is a VC++ group, you are more
likely to find help in one of the C# groups, e.g.:

microsoft.public.dotnet.languages.csharp

or perhaps in one of the platform groups, e.g.:

micosoft.public.dotnet.framework

Regards,
Will

www.ivrforbeginners.com
Jan 24 '07 #3
"William DePalo [MVP VC++]" <wi***********@mvps.orgwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
"Sourcerer" <en****@MAKNIgmail.comwrote in message
news:ep**********@ss408.t-com.hr...
>I've started my first practice windows service project in C#, and I'm already
stuck.

You may get a response here, but as this is a VC++ group, you are more likely
to find help in one of the C# groups, e.g.:

microsoft.public.dotnet.languages.csharp

or perhaps in one of the platform groups, e.g.:

micosoft.public.dotnet.framework

Ah, I see. The group name doesn't specify the language and I've seen some C#
questions being answered here, so I thought I'm at the right place.

Thanks for the directions.

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/

Jan 24 '07 #4

"Sourcerer" <en****@MAKNIgmail.comwrote in message
news:ep**********@ss408.t-com.hr...
"William DePalo [MVP VC++]" <wi***********@mvps.orgwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>"Sourcerer" <en****@MAKNIgmail.comwrote in message
news:ep**********@ss408.t-com.hr...
>>I've started my first practice windows service project in C#, and I'm
already stuck.

You may get a response here, but as this is a VC++ group, you are more
likely to find help in one of the C# groups, e.g.:

microsoft.public.dotnet.languages.csharp

or perhaps in one of the platform groups, e.g.:

micosoft.public.dotnet.framework


Ah, I see. The group name doesn't specify the language and I've seen some
C# questions being answered here, so I thought I'm at the right place.
Actually it does, only "C" is such a short name that it might not jump out
at you. (Though people never have trouble figuring out "VB"...)
>
Thanks for the directions.

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/

Jan 24 '07 #5
"Ben Voigt" <rb*@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>
"Sourcerer" <en****@MAKNIgmail.comwrote in message
news:ep**********@ss408.t-com.hr...
>"William DePalo [MVP VC++]" <wi***********@mvps.orgwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>>"Sourcerer" <en****@MAKNIgmail.comwrote in message
news:ep**********@ss408.t-com.hr...
I've started my first practice windows service project in C#, and I'm
already stuck.

You may get a response here, but as this is a VC++ group, you are more
likely to find help in one of the C# groups, e.g.:

microsoft.public.dotnet.languages.csharp

or perhaps in one of the platform groups, e.g.:

micosoft.public.dotnet.framework


Ah, I see. The group name doesn't specify the language and I've seen some C#
questions being answered here, so I thought I'm at the right place.

Actually it does, only "C" is such a short name that it might not jump out at
you. (Though people never have trouble figuring out "VB"...)
Mind you, C is a lot different than C++.
And there is no VC in dotnet as far as I know (only VC++ and VC#).

Since the group name doesn't specify whether it's about VC++ or VC#, I assumed
it's about both. I wasn't at all confused about whether or not it discusses VB
or VJ# or something else.

--
"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/

Jan 24 '07 #6

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

Similar topics

4
2219
by: rbt | last post by:
How does one associate a "Description" with a Windows service written in Python? I've just started experimenting with Python services. Here's my code... copied straight from Mr. Hammond's "Python...
6
2538
by: cs | last post by:
I noticed there is some .net services on my winxp. One or two mention the CLR. Does that mean that my .net apps/services wont run before those services start? I need to run my service as early on...
0
2132
by: Diego F. | last post by:
I've been days with that. I'm trying to work with web services sending and returning objects, and the web service must store some objects. - My first try (the most obvious in my opinion) was to use...
26
1858
by: Mr Newbie | last post by:
What do I need to run a web service on my PC ? I know I need the .NET Framework, but do I need IIS Running ?
3
6466
by: Matt D | last post by:
I've got two web services that use the same data types and that clients will have to consume. I read the msdn article on sharing types...
7
6002
by: Stu | last post by:
Hi, I have a web service which returns a record set and works well integrated with an asp dot net page. However if I decided to develop a unix app will i be able to read the dataset as it is...
3
4961
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 : ...
2
2052
by: sdstraub | last post by:
I have created 5 services in my project, in the 1st service I set servicestorun = array of all 5 services, I have a project installer with 5 service installers, one for each service. I have code...
0
1785
by: krishnaraju | last post by:
HI to all, please help me.its urgent requirement. my question is this is the wsdl file i got from our client.please see at bottom. when iam trying to access that webmethods iam getting...
1
2171
by: Data Entry Outsourcing | last post by:
Data Entry plays vital role in every business area. Data Entry is one such aspects of any business that needs to be handled properly for expanding your business. Data Entry is one of the leading...
0
7100
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
6964
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...
0
7126
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7175
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...
1
6842
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...
0
7330
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...
1
4865
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...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.