Help With Windows Services

A

ags5406

Hi All

I have a task that I'm thinking about attacking in two different ways
but don't know enough about Windows Services.

First:

We have a server application written in VB.net that acts as a
middleman between various Fortan DLL's (the calculation engines) and
various front end client applications (one in Java and two in
VB.net). The front ends check to see if the server application is
running when they need some calculations and if it's not running they
start it up. Simple enough and works great.

Well, now the powers that be have decided that the server application
should be a Windows Service (and always be running), rather than a
standalone executable.

I thought that I had correctly converted the project to a service. It
compiles and installs just fine. And it seems to run with no
problems. However, when I actually make a call to the service I keep
getting errors back (from Fortran) telling me that various
configuration files are missing (these are text files and binary files
containing engineering data needed by the Fortran code). They are in
the same location that they have always been (the same folder as the
windows service EXE), but for some reason now they can't be found,
where as before there was no issue. Having a difficult time
determining whether this is a Fortran or a VB.net problem, especially
since the debugging is trickier for Windows Services than just for
straight executables.

Is there a special location on the drive when all support files for
any Windows Service need to be located?

Second:

Another idea I had is rather than integrate all of the code from the
server application into a new Windows service, I'd possibly keep the
same executable and have the service just act as a wrapper, always
monitoring whether or not the server application executable is running
and restarting it whenever it stops (for whatever reason). This would
seem to be much simpler and would leave open the option of returning
to the old method should we decide that the windows service route
isn't for us (we all know that management tends to change their minds
often). I had originally pursued this path but was unsure how to do
this with only the service OnStart and OnStop methods available.

Thanks in advance for any assistance.
 
T

Tom Shelton

Hi All

I have a task that I'm thinking about attacking in two different ways
but don't know enough about Windows Services.

First:

We have a server application written in VB.net that acts as a
middleman between various Fortan DLL's (the calculation engines) and
various front end client applications (one in Java and two in
VB.net). The front ends check to see if the server application is
running when they need some calculations and if it's not running they
start it up. Simple enough and works great.

Well, now the powers that be have decided that the server application
should be a Windows Service (and always be running), rather than a
standalone executable.

I thought that I had correctly converted the project to a service. It
compiles and installs just fine. And it seems to run with no
problems. However, when I actually make a call to the service I keep
getting errors back (from Fortran) telling me that various
configuration files are missing (these are text files and binary files
containing engineering data needed by the Fortran code). They are in
the same location that they have always been (the same folder as the
windows service EXE), but for some reason now they can't be found,
where as before there was no issue. Having a difficult time
determining whether this is a Fortran or a VB.net problem, especially
since the debugging is trickier for Windows Services than just for
straight executables.

Is there a special location on the drive when all support files for
any Windows Service need to be located?

Second:

Another idea I had is rather than integrate all of the code from the
server application into a new Windows service, I'd possibly keep the
same executable and have the service just act as a wrapper, always
monitoring whether or not the server application executable is running
and restarting it whenever it stops (for whatever reason). This would
seem to be much simpler and would leave open the option of returning
to the old method should we decide that the windows service route
isn't for us (we all know that management tends to change their minds
often). I had originally pursued this path but was unsure how to do
this with only the service OnStart and OnStop methods available.

Thanks in advance for any assistance.

Since all of your front end's are java and .net - have you considered
turning your server app into a web service?
 
A

ags5406

Since all of your front end's are java and .net - have you considered
turning your server app into a web service?

Have not. Know even less about web services (nothing actually). Does
that require a network connection?

Several of the clients are run on network computers. However, the
main (possibly most important) client runs on a laptop computer (or
other terminal) completely disconnected from any network in an
airborne vehicle. So the client, the server app, and the DLL's are
essentially in a vacuum on each machine.
 
T

Tom Shelton

Have not. Know even less about web services (nothing actually). Does
that require a network connection?

Several of the clients are run on network computers. However, the
main (possibly most important) client runs on a laptop computer (or
other terminal) completely disconnected from any network in an
airborne vehicle. So the client, the server app, and the DLL's are
essentially in a vacuum on each machine.

The web service could still work... But you are probably better off
using a service. So the problem that your having with the service is
that it is not finding some of it's resources?
 
A

ags5406

The web service could still work... But you are probably better off
using a service. So the problem that your having with the service is
that it is not finding some of it's resources?

Well oddly enough I've solved my problem. What seems to happen so
often is I struggle and struggle with a problem and then right after I
post here the answer dawns on me. It was actually pretty simple. I
went with method two as I described in my original message. It allows
me to preserve the original server application.
From the OnStart method in the windows service I launched a separate
thread (so the OnStart method could actually complete its task). And
then within the thread I simply created an infinite loop to keep
checking the process list and to launch the server app if it is
missing from the process list.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top