472,805 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 software developers and data experts.

Windows Setup Project - Installing an .exe with a service

Hello:

I wrote an .exe that I would like to be called by a service I am
deploying to a server. However, I am not sure how to tell the setup
project to include the .exe.

Also, I do not know how to tell the service where the .exe actually
resides on the server. I would like to prevent hard-coding it since
the software will be distributed to different offices in my company.

Is it possible to include an .exe and to tell the service where to
find it?

Thanks,
Travis

Nov 2 '07 #1
1 1713
I solved my own issue. I found a web site that suggested putting
[TARGETDIR] into the registry view. That worked like a charm! It
stores the installation directory into the registry, which I retrieve
later on in my service.

-------------------------------------------------------------------------------

For a little background, I had written a service that checked whether
user's passwords were about to expire on our LDAP server. However, for
some reason, Windows Services seem incapable of handling the exception
correctly. Even though I would surround the entire service in try/
catch blocks, the exceptions would still terminate the program every
time. I am not sure if this is a Microsoft issue or a Novell issue.

Well, I tried a lot of things to prevent the service from stopping.
People on this forum were suggesting all kinds of crazy things and
none of their suggestions helped (some didn't make sense). Then
someone finally made me aware that Windows services operate with
different apartments than most applications. Somehow this affects how
services handle exceptions. That wonderful person suggested that I
separate the service code from the body code. However, they suggested
making a COM library and invoking it using some weird stuff I have
never heard of.

I took the simpler approach and just tried to make a library. However,
the library approach didn't work because the library methods were
being run under the service, which is essentially no different than
having them inside the service. I wasn't daunted, though, and I simply
made the library into a Console application and added a Main method.
Now my service simply executes the console application. Since Console
applications don't suffer from the strange exception handling gook
that services do, my errors are handling correctly . . . which means
my service has the benefit of just calling the console application
every some many hours. It is a nice separation of responsibility - now
I have a very nice shell for future services.

The only problem I had to figure out was how to get my service, which
runs with a path under System32 (that's default) to execute my console
application in my application directory. I simply put [TARGETDIR] in
the registry when the setup project runs and I can access it in my
service. Huzzah!

Thanks to everyone who tried to help me resolve my issue, I'm just
glad to be done with it, finally.

~Travis

Nov 2 '07 #2

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

Similar topics

2
by: Ken Lindner | last post by:
I have a need to become familiar with SQL Server 2000 for work. Needless to say I am new to SQL Server any version, but not IT in general. My employer has provided me with the SQL Server 2000...
8
by: D Busby | last post by:
List I've made a .NET windows service in C++, then I added an installer to the solution. I added the 'Project Output' from my .NET service as a package for the installer to install however it does...
3
by: MW | last post by:
Hi all, I have written a windows service application and setup project to install/deinstall my service. There is a requirement to run one more instance of the same service with different set...
0
by: Theresa Smallwood | last post by:
I am having some trouble with a windows service I am trying to install. It builds just fine, but when I try to install it using an MSI created from a ..NET setup project, I get this error: ...
3
by: Jeremy S. | last post by:
On my dev machine (XP/Pro with VS.NET 2003) I have been developing a Windows Service and installing it on the local machine by opening the Visual Studio Command Prompt and then executing . Now I...
4
by: bob lambert | last post by:
Help I am trying to deploy to another pc a vb.net std 2002 windows form application. I am confused. I created a project - windows form I built form, compiled and debugged. I created a...
0
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...
0
by: msalman | last post by:
Hey I created a windows service and added it to a setup project. The setup project should install the service and run it but for some reasons it doesn't install the service and gives following...
5
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?...
0
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi again misters, I try install my windows service using MSI (setup project) I read this article http://msdn.microsoft.com/en-us/library/bb332338.aspx
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.