C# Windows Service doesn't seem to like privatePath
Posted
by SauerC
on Stack Overflow
See other posts from Stack Overflow
or by SauerC
Published on 2010-04-23T17:43:41Z
Indexed on
2010/05/01
0:57 UTC
Read the original article
Hit count: 318
c#
|windows-services
I wrote a C# Windows Service to handle task scheduling for our application. I'm trying to move the "business rules" assemblies into a bin subdirectory of the scheduling application to make it easier for us to do updates (stop service, delete all files in bin folder, replace with new ones, start service).
I added
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="bin;"/>
</assemblyBinding>
</runtime>
to the service's app config and it works fine if the service is run as a console application. Problem is when the service is run as a windows service it doesn't work. It appears that when windows runs the service the app config file gets read properly but then the service is executed as if it was in c:\windows\system32 and not the actually EXE location and that gums up the works.
We've got a lot of assemblies so I really don't want to use the GAC or <codeBase>
. Is it possible to have the EXE change it's base directory back to where it should be when it's run as a service?
© Stack Overflow or respective owner