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

Home Posts Topics Members FAQ

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\Co nfig.CFG). After it receives something (anything), then
it is supposed to open a file C:\MyService\Fi le.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
"Walkthroug h: 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/

Jan 24 '07 #1
2 4022
Sourcerer,

You could use tons of options to listen for something. You could go
remoting, sockets. You could also go something that it is not listening by
itself, but works the way you want, like message queues.

A good reading would be:
http://www.codeproject.com/cs/internet/TCPIPChat.asp
http://www.codeproject.com/cs/intern...erandClien.asp

The very first article is pretty good and matches what you need.

I hope it helps.

--
Regards,
Robson Siqueira
Enterprise Architect
"Sourcerer" <en****@MAKNIgm ail.comwrote in message
news:ep******** **@ss408.t-com.hr...
>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\Co nfig.CFG). After it receives something
(anything), then
it is supposed to open a file C:\MyService\Fi le.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
"Walkthroug h: 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/

Jan 24 '07 #2
"Robson Siqueira" <ro****@robsonf elix.comwrote in message
news:OG******** ******@TK2MSFTN GP02.phx.gbl...
Sourcerer,

You could use tons of options to listen for something. You could go remoting,
sockets. You could also go something that it is not listening by itself, but
works the way you want, like message queues.

A good reading would be:
http://www.codeproject.com/cs/internet/TCPIPChat.asp
http://www.codeproject.com/cs/intern...erandClien.asp

The very first article is pretty good and matches what you need.

I hope it helps.
Thanks, I'll be back if I have more questions.

--
"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 #3

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

Similar topics

2
1556
by: Lord Brett Sinclair | last post by:
Hello everybody I created a windows services with an msi file. I have another small vb.net exe that I would like to install when I install the windows service. I tried to create a merge module for the exe, and added it to the windows service...but somehow, I can not get the exe to be installed. Can somebody can point me to the right direction ? Regards LBS
2
3294
by: raghavendra | last post by:
Hi, How to run automatically windows service by using setup deployment insatllation script using visual studio 2003.? What i did is :-- 1. created a windows service & tested the same. 2. then i used the windowsservice.exe in setup deployment project.
17
6451
by: UJ | last post by:
Is there any way for a windows service to start a windows program ? I have a service that will need to restart a windows app if it needs to. TIA - Jeff.
2
6904
by: deko | last post by:
When to use a privileged user thread rather than a windows service? That's the question raised in a previous post . It was suggested that if the service needs to interact with a WinForms app (which is the UI used to adjust the actions taken by, and the schedule of the service), then a privileged user thread should be used in the UI - no service required. But... "A windows service enables the creation of long-running executable
0
2700
by: =?Utf-8?B?U2ltb25EZXY=?= | last post by:
Hi All I would like to install the same Windows Service project on the same server under different names, one for each customer. I have been able to do it but I would like an expert opinion as to whether my solution is robust or whether there is a better way to do it. What I've been trying to do is to create a core project with different extension projects, one for each customer. I wanted to create a different Setup project for each...
2
4504
by: =?Utf-8?B?dmlzaHJ1dGg=?= | last post by:
Hi, I have 2 applications running, one Windows application project and the other windows services project. I want to call my Windows application in my windows services. I want to run them as seperate process. If my windows application starts running,only if it completes fully, then my windows services should continue its execution. My main process is Windows service.
41
11667
by: pbd22 | last post by:
Hi. I know my windows service works when i run it in debug mode on my dev machine. It also works in release mode on my dev machine. But, when I move the service to a production server, it exits immediately with a start/stop/nothing to do error. What could be wrong?
5
3312
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name? Why do I need to set a property within my code to the service name? Are all these required or am I just doing this for consistency purposes?
1
2090
by: =?Utf-8?B?TWFuanJlZSBHYXJn?= | last post by:
Hi, I created a web service that I want to host in windows service. The problem is that if I host it as windows service it does not use the configuration file. I have to define the binding, endpoint etc. programmatically in the Program.cs file. Any idea what I might be doing wrong? Cheers,
1
2545
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
I am reviewing Windows service programming. I'm running VS2005 and programming in VB. I've just found an example in Support: 'How to create a Setup project for a Windows Service in Visual Basic .NET or in Visual Basic 2005' http://support.microsoft.com/kb/317421 I've been able to program and run this example without problems. However, I wonder if I'm missing the point here. How do you deploy a service like this to a machine...
0
9704
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
9571
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,...
0
10561
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10069
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...
1
7608
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
6845
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();...
0
5505
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.