Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / October 2007

Tip: Looking for answers? Try searching our database.

Assembly path

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jesper Rou - 08 Oct 2007 10:50 GMT
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
Vadym Stetsiak - 08 Oct 2007 12:27 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.