473,513 Members | 2,752 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Development Question Regarding Windows Services

Hello, I'm performing some research to determine the feasibility of
developing a Windows Service (see
http://en.wikipedia.org/wiki/Windows_Service for the specific
definition of "service" to which I'm referring) to perform a particular
task. I'm having some trouble determining if a service's
functionality can be accessed in a non-I/O manner (such as avoiding
Sockets, reading and writing a temp file, etc).

Basically, I'd like to call a method on a running service, and have it
return an object (similar to a factory's getInstance method). All I've
been able to find so far is that a service can implement the
"OnCustomCommand" method, which only provides one-way communication
from the caller to the service, allowing an integer argument to be
specified.

A potential solution that I'm currently noodling over is to retrieve an
instance of the service via the ServiceController class, and cast the
resulting object to the specific class of the service which I write.
Unfortunately, I can't test this today, as I have to wait until the
network admin enables the security settings to allow me to install a
service (and that won't be until tomorrow).

A good analogy to what I'm trying to do is to imagine a Database
Connection Pool as a windows service. When the machine starts up,
<i>n</iconnections are created and held as available. At some point,
an application needing database connectivity requests an available
connection from the connection pool, which will then provide one to the
application. Ideally, I'd like to avoid using remoting, as it involves
a lot of serialization (if I understand its behavior correctly), and
performance is critical.

Thanks in advance,
Rob

Jan 4 '07 #1
3 1541

The ServiceController stuff should usually only be used to actually
control the service, start and stop it and such. To actually
communicate with your service use custom methods. I usually use .NET
Remoting but you can also use TCP sockets, named pipes, or any of the
other Windows inter-process communication mechanisms.

Usually when developing a windows service it's good do think of the
windows service part of it as being an add-on. You develop your core
functionality within a dlll and it works totally on it's own. Then
you can built a windows service project that hosts this dll. You can
also use the dll directly from other projects (easier development) and
can create console application wrappers (again, easier development).

HTH,

Sam
------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.

On 3 Jan 2007 16:02:11 -0800, rk*****@gmail.com wrote:
>Hello, I'm performing some research to determine the feasibility of
developing a Windows Service (see
http://en.wikipedia.org/wiki/Windows_Service for the specific
definition of "service" to which I'm referring) to perform a particular
task. I'm having some trouble determining if a service's
functionality can be accessed in a non-I/O manner (such as avoiding
Sockets, reading and writing a temp file, etc).

Basically, I'd like to call a method on a running service, and have it
return an object (similar to a factory's getInstance method). All I've
been able to find so far is that a service can implement the
"OnCustomCommand" method, which only provides one-way communication
from the caller to the service, allowing an integer argument to be
specified.

A potential solution that I'm currently noodling over is to retrieve an
instance of the service via the ServiceController class, and cast the
resulting object to the specific class of the service which I write.
Unfortunately, I can't test this today, as I have to wait until the
network admin enables the security settings to allow me to install a
service (and that won't be until tomorrow).

A good analogy to what I'm trying to do is to imagine a Database
Connection Pool as a windows service. When the machine starts up,
<i>n</iconnections are created and held as available. At some point,
an application needing database connectivity requests an available
connection from the connection pool, which will then provide one to the
application. Ideally, I'd like to avoid using remoting, as it involves
a lot of serialization (if I understand its behavior correctly), and
performance is critical.

Thanks in advance,
Rob
Jan 4 '07 #2
Hi Sam, thanks for the reply.

Your comments on the ServiceController cleared things up greatly, it
makes sense that a controller controls the service (duh!). Do you know
of any performance bottlenecks associated with service communication
via remoting (I have examined it a bit, and since the connections are
to be on the same box, it'll probably use an IpcChannel for the
remoting).

I completely agree with the 'bolt-on' approach you describe.
Unfortunately, some people (ahem, Mr. System Architect) don't quite see
eye to eye on this one, and we're stuck implementing their wonderful
visions. Basically, he's visualizing the 'connection pool' (for lack
of a better term) part of the application as the 'bolt-on' part, not
part of the core functionality. Looks like I have a bit of social
engineering to do ;)

Thanks again!
Rob

Samuel R. Neff wrote:
The ServiceController stuff should usually only be used to actually
control the service, start and stop it and such. To actually
communicate with your service use custom methods. I usually use .NET
Remoting but you can also use TCP sockets, named pipes, or any of the
other Windows inter-process communication mechanisms.

Usually when developing a windows service it's good do think of the
windows service part of it as being an add-on. You develop your core
functionality within a dlll and it works totally on it's own. Then
you can built a windows service project that hosts this dll. You can
also use the dll directly from other projects (easier development) and
can create console application wrappers (again, easier development).

HTH,

Sam
------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.

On 3 Jan 2007 16:02:11 -0800, rk*****@gmail.com wrote:
Hello, I'm performing some research to determine the feasibility of
developing a Windows Service (see
http://en.wikipedia.org/wiki/Windows_Service for the specific
definition of "service" to which I'm referring) to perform a particular
task. I'm having some trouble determining if a service's
functionality can be accessed in a non-I/O manner (such as avoiding
Sockets, reading and writing a temp file, etc).

Basically, I'd like to call a method on a running service, and have it
return an object (similar to a factory's getInstance method). All I've
been able to find so far is that a service can implement the
"OnCustomCommand" method, which only provides one-way communication
from the caller to the service, allowing an integer argument to be
specified.

A potential solution that I'm currently noodling over is to retrieve an
instance of the service via the ServiceController class, and cast the
resulting object to the specific class of the service which I write.
Unfortunately, I can't test this today, as I have to wait until the
network admin enables the security settings to allow me to install a
service (and that won't be until tomorrow).

A good analogy to what I'm trying to do is to imagine a Database
Connection Pool as a windows service. When the machine starts up,
<i>n</iconnections are created and held as available. At some point,
an application needing database connectivity requests an available
connection from the connection pool, which will then provide one to the
application. Ideally, I'd like to avoid using remoting, as it involves
a lot of serialization (if I understand its behavior correctly), and
performance is critical.

Thanks in advance,
Rob
Jan 4 '07 #3

We developed an app for a client that insisted on physical separation
so the entire web UI ran on one box and communicated with a windows
service on another box via remoting. Our testing showed that the
overhead due to remoting was under 10ms per call.

And a Mr. System Architect that doesn't understand separating code
into modules and plugging things together is hilarious. Sorry to hear
that.. just remember...

------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.

On 4 Jan 2007 07:15:35 -0800, rk*****@gmail.com wrote:
>Hi Sam, thanks for the reply.

Your comments on the ServiceController cleared things up greatly, it
makes sense that a controller controls the service (duh!). Do you know
of any performance bottlenecks associated with service communication
via remoting (I have examined it a bit, and since the connections are
to be on the same box, it'll probably use an IpcChannel for the
remoting).

I completely agree with the 'bolt-on' approach you describe.
Unfortunately, some people (ahem, Mr. System Architect) don't quite see
eye to eye on this one, and we're stuck implementing their wonderful
visions. Basically, he's visualizing the 'connection pool' (for lack
of a better term) part of the application as the 'bolt-on' part, not
part of the core functionality. Looks like I have a bit of social
engineering to do ;)

Thanks again!
Rob
Jan 4 '07 #4

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

Similar topics

1
1440
by: Michiel | last post by:
Which MSDN CD's exactly must I install to obtain a web services development environment (e.g. with C#) on my Win2k laptop. Presumably Visual Studio .NET, but what version exactly? And what else? We...
7
3346
by: Al Wilkerson | last post by:
In regards to getting a job, do you guys feel theer is more of a demand for Windows .Net development or Web .Net development? Also, which language is more in demand VB.Net or C#, or is it more...
0
1177
by: Neill W | last post by:
My development team produce a mixture of client and server applications and components all of which are .Net based. Many of these use core Windows services such as MSMQ, COM+ and IIS. Our target...
9
1191
by: Guadala Harry | last post by:
This inquiry has to do with the client capabilities and Web client experience: I've been developing rich client apps (Windows desktop client exes in n-tier architecture) for over 10 years and am...
16
1886
by: Linus | last post by:
Being a ASP developer for a consultant company thinking of starting developing with ASP.NET I have read literally hundreds of web pages and posts in discussion forums on the Internet to get an idea...
6
1948
by: Steve Mauldin | last post by:
I have three websites that were developed by using the same code in .net. They are all located under wwwroot on my desktop running windows 2000 pro.because Windows 2000 pro only supports a single...
0
1064
by: =?Utf-8?B?bm95ZXM=?= | last post by:
I have a solution that contains a windows forms project and some web service projects. Some of the web service projects are file-based and some are project based. When I run the application from...
0
3895
by: ronscottlangham | last post by:
I have a WCF Web Service that I develop using the ASP.NET Development Server in Visual Studio. In release, the web service will support both HTTP and HTTPS. Initially I had only HTTP configured in...
0
7373
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,...
1
7094
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
7519
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
5677
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,...
1
5079
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
4743
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...
0
3230
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...
0
1585
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 ...
0
452
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...

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.