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
Jesper Rou - 08 Oct 2007 13:06 GMT
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
> Hello, Jesper!
>
[quoted text clipped - 32 lines]
>
> JR> - Jesper Rou / Creuna Denmark