Assembly path

J

Jesper Rou

Hi everyone,

I have a windows service project, that references the assembly from a web
project.
My problem is that on the production server, the service's directory path
points at the system32 folder, and not the folder where its own .exe fil is
located which would be the normal behavior.

This means that it cannot locate its config file, nor the dll from the
referenced assembly.

I can fix the config problem by loading the configuration explicit from a
hardcoded path (ugly).
The assembly is another matter though, and loading it into the GAC is not an
option. I could drop the referenced dll into the system32 folder, but that
is about as ugly as it gets.

I've made a number of services before that never had this problem and the
main difference here is the reference to an external dll.

Anyone have any idea how to "fix" the service's startup path?

Thank you, in advance!

- Jesper Rou / Creuna Denmark
 
V

Vadym Stetsiak

Hello, Jesper!

Did you try getting assembly path via
Assembly.GetExecutingAssembly().Location ?

--
With best regards, Vadym Stetsiak.
Blog: http://vadmyst.blogspot.com


You wrote on Mon, 8 Oct 2007 11:50:55 +0200:

JR> Hi everyone,

JR> I have a windows service project, that references the assembly from
JR> a web project.
JR> My problem is that on the production server, the service's directory
JR> path points at the system32 folder, and not the folder where its
JR> own .exe fil is located which would be the normal behavior.

JR> This means that it cannot locate its config file, nor the dll from
JR> the referenced assembly.

JR> I can fix the config problem by loading the configuration explicit
JR> from a hardcoded path (ugly).
JR> The assembly is another matter though, and loading it into the GAC
JR> is not an option. I could drop the referenced dll into the system32
JR> folder, but that is about as ugly as it gets.

JR> I've made a number of services before that never had this problem
JR> and the main difference here is the reference to an external dll.

JR> Anyone have any idea how to "fix" the service's startup path?

JR> Thank you, in advance!

JR> - Jesper Rou / Creuna Denmark
 
J

Jesper Rou

Hi Vadym,

I just tried that, and it reported the, somewhat surprising, correct path.

So, the problem remains, that it cannot locate the referenced assembly that
resides in same folder.
That assembly handles logging and loading of configuration data, and since
it dosnt know "where it is", if cannot find the config file and the log file
ends up in the system32 folder.

- Jesper
 

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