473,406 Members | 2,710 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,406 software developers and data experts.

Windows Service Launching C# App

Hello, I'm hoping someone can give me some help or guidance here. I'm not
sure if this is even the best group to post to for this.

Our OEM equipment's software architecture relies heavily on a "master"
windows service. This responsibility of this service is to launch 10 or so
other applications, some of which have GUI's. These applications need to be
running whether somebody is logged in or not. There is no communication
required between the master service and the individual applications. An
external configuration file is read by the master service when it starts,
telling it which applications to launch and what other behavior is desired.
So, when a newly developed application requires that it be running when
nobody is logged in, information is simply added to the configuration file
and we're done. Currently, all of these applications are C++/MFC and the
trick (hack?) used to keep these applications running when a user logoff
occurs is related to http://support.microsoft.com/kb/q164166/ . This has
been working well for several years.

Now to my question. I recently completed development on a GUI C# application
which I would like to run in the same manner as described above. Everything
starts up fine, but my C# application does not survive the logoff, and in
some cases interferes with it. Is there a way to get past this or should I
start looking for another solution (like rewrite it in C++). Hope this makes
sense to somebody and thanks in advance for any advice.
Brad Jones (Not CoduGuru guy!)
Jul 21 '05 #1
3 2181
I assume you need the functionality to be usable from both a GUI and a
service.
Is there a reason why you can't factor out the common code into a
separate library, and then call it from the service and the GUI?
Brad Jones wrote:
Hello, I'm hoping someone can give me some help or guidance here. I'm not
sure if this is even the best group to post to for this.

Our OEM equipment's software architecture relies heavily on a "master"
windows service. This responsibility of this service is to launch 10 or so
other applications, some of which have GUI's. These applications need to be
running whether somebody is logged in or not. There is no communication
required between the master service and the individual applications. An
external configuration file is read by the master service when it starts,
telling it which applications to launch and what other behavior is desired.
So, when a newly developed application requires that it be running when
nobody is logged in, information is simply added to the configuration file
and we're done. Currently, all of these applications are C++/MFC and the
trick (hack?) used to keep these applications running when a user logoff
occurs is related to http://support.microsoft.com/kb/q164166/ . This has
been working well for several years.

Now to my question. I recently completed development on a GUI C# application
which I would like to run in the same manner as described above. Everything
starts up fine, but my C# application does not survive the logoff, and in
some cases interferes with it. Is there a way to get past this or should I
start looking for another solution (like rewrite it in C++). Hope this makes
sense to somebody and thanks in advance for any advice.
Brad Jones (Not CoduGuru guy!)

Jul 21 '05 #2
Hi Joshua, thanks for the response.

These applications do not need to be invoked independent of the service,
although they can be. Our equipment populates circuit boards with
components, and most of the applications handle various conditions and
situations that can occur requiring user intervention to resolve. So, in
essence, the applications act like services with GUI's.

A customer typically starts the production run and logs out for security
reasons. Many times another user will log in with reduced privileges but the
machine continues to run during any logouts. Since, as you know, services
don't readily support a GUI, the method I described earlier is how we get
around that. All applications started by the master service
(CreateProcess()/CreateProcessAsUser()) remain running until machine/windows
shutdown. We display dialogs, handle windows messages, and even access the
network if needed (using a predefined account) without anyone logged in.
There are lights on the equipment which alert the user to any problems. BTW
we are running Win2k Pro.

I guess I'm looking for an equivalent method (again...hack?) to keep the C#
app running during a logoff. Maybe one doesn't exist. Rearchitecting is not
really an option at this point. I'd sooner be forced to do a rewrite in C++.

I don't know if any of that information is helpful, but thanks again for
taking the time to respond.
"Joshua Flanagan" <jo**@msnews.com> wrote in message
news:eZ**************@TK2MSFTNGP12.phx.gbl...
I assume you need the functionality to be usable from both a GUI and a
service.
Is there a reason why you can't factor out the common code into a
separate library, and then call it from the service and the GUI?
Brad Jones wrote:
Hello, I'm hoping someone can give me some help or guidance here. I'm not
sure if this is even the best group to post to for this.

Our OEM equipment's software architecture relies heavily on a "master"
windows service. This responsibility of this service is to launch 10 or
so
other applications, some of which have GUI's. These applications need to
be
running whether somebody is logged in or not. There is no communication
required between the master service and the individual applications. An
external configuration file is read by the master service when it starts,
telling it which applications to launch and what other behavior is
desired.
So, when a newly developed application requires that it be running when
nobody is logged in, information is simply added to the configuration
file
and we're done. Currently, all of these applications are C++/MFC and the
trick (hack?) used to keep these applications running when a user logoff
occurs is related to http://support.microsoft.com/kb/q164166/ . This has
been working well for several years.

Now to my question. I recently completed development on a GUI C#
application
which I would like to run in the same manner as described above.
Everything
starts up fine, but my C# application does not survive the logoff, and in
some cases interferes with it. Is there a way to get past this or should
I
start looking for another solution (like rewrite it in C++). Hope this
makes
sense to somebody and thanks in advance for any advice.
Brad Jones (Not CoduGuru guy!)

Jul 21 '05 #3
That's very interesting. Sorry I don't have any solution for your
immediate problem. If you do consider re-architecting in the future,
I'd suggest that you look into creating a separate GUI application that
communicates with the service via .NET remoting. That way the service
can continue to run and do its work when a user is logged out - but a
logged in user would still be able to interact with the service (through
the separate GUI client).

Good luck!

Brad Jones wrote:
Hi Joshua, thanks for the response.

These applications do not need to be invoked independent of the service,
although they can be. Our equipment populates circuit boards with
components, and most of the applications handle various conditions and
situations that can occur requiring user intervention to resolve. So, in
essence, the applications act like services with GUI's.

A customer typically starts the production run and logs out for security
reasons. Many times another user will log in with reduced privileges but the
machine continues to run during any logouts. Since, as you know, services
don't readily support a GUI, the method I described earlier is how we get
around that. All applications started by the master service
(CreateProcess()/CreateProcessAsUser()) remain running until machine/windows
shutdown. We display dialogs, handle windows messages, and even access the
network if needed (using a predefined account) without anyone logged in.
There are lights on the equipment which alert the user to any problems. BTW
we are running Win2k Pro.

I guess I'm looking for an equivalent method (again...hack?) to keep the C#
app running during a logoff. Maybe one doesn't exist. Rearchitecting is not
really an option at this point. I'd sooner be forced to do a rewrite in C++.

I don't know if any of that information is helpful, but thanks again for
taking the time to respond.
"Joshua Flanagan" <jo**@msnews.com> wrote in message
news:eZ**************@TK2MSFTNGP12.phx.gbl...
I assume you need the functionality to be usable from both a GUI and a
service.
Is there a reason why you can't factor out the common code into a
separate library, and then call it from the service and the GUI?
Brad Jones wrote:
Hello, I'm hoping someone can give me some help or guidance here. I'm not
sure if this is even the best group to post to for this.

Our OEM equipment's software architecture relies heavily on a "master"
windows service. This responsibility of this service is to launch 10 or
so
other applications, some of which have GUI's. These applications need to
be
running whether somebody is logged in or not. There is no communication
required between the master service and the individual applications. An
external configuration file is read by the master service when it starts,
telling it which applications to launch and what other behavior is
desired.
So, when a newly developed application requires that it be running when
nobody is logged in, information is simply added to the configuration
file
and we're done. Currently, all of these applications are C++/MFC and the
trick (hack?) used to keep these applications running when a user logoff
occurs is related to http://support.microsoft.com/kb/q164166/ . This has
been working well for several years.

Now to my question. I recently completed development on a GUI C#
application
which I would like to run in the same manner as described above.
Everything
starts up fine, but my C# application does not survive the logoff, and in
some cases interferes with it. Is there a way to get past this or should
I
start looking for another solution (like rewrite it in C++). Hope this
makes
sense to somebody and thanks in advance for any advice.
Brad Jones (Not CoduGuru guy!)


Jul 21 '05 #4

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

Similar topics

3
by: DH | last post by:
I hope this is a right place to post my question I'm working on a Windows service application with VB.net. The purpose is to let the service application as a monitor to periodically check a...
3
by: James Dixon | last post by:
I have created a windows service in C#, .net framework 1.1 The service makes a web request using the mshtml.HTMLDocument.CreateDocumentFromURL() function Because this is not using...
0
by: Henk Verhoeven | last post by:
Afternoon I am launching a 3rd party EXE application from within a service (with interact with desktop checked), the programs starts up fine, but this 3rd part application prints to a PDF...
11
by: Andrew Mueller | last post by:
Hello, Is there any way to make a form part of a windows service application and launch it upon double-click of a system tray icon? I already have the NotifyIcon working and have added an...
7
by: scarred wind | last post by:
when i run my program, an error message prompt me that i should add the installutil.exe. How do i checked for the installutil.exe? How can i add it to my Timer program? ...
5
by: Nick | last post by:
hi, all Recently, our server which is a windows service got a problem. This windows service will launch a process to process user's data each time when a user connection comes in. The problems,...
6
by: Leonardo Curros | last post by:
Hello, I would like to know what's the best way to restart one service. I would like to do it from the service itself. Is this possible? I try it with ServiceController.stop()...
3
by: Brad Jones | last post by:
Hello, I'm hoping someone can give me some help or guidance here. I'm not sure if this is even the best group to post to for this. Our OEM equipment's software architecture relies heavily on a...
7
by: Ahmed Perlom | last post by:
Hi all, I am trying to start a windows application that has a GUI from a Windows service written in .NET 2.0. I have been searching on this for few days now with no avail. When using the...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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,...
0
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...

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.