Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Run as service problem
Message
 
To
08/01/2005 17:26:18
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00975455
Message ID:
00975484
Views:
13
After a little more research, i found that i get the error only when i try to load an assembly thru reflection:
string assemblyName = "MyAssembly.dll";
Assembly assembly = Assembly.LoadFrom( assemblyName );
//In a console app this line works just fine
//but fails in a service application

//the following works in the service application:
string assemblyName = "MyAssembly.dll";
Assembly assembly = Assembly.LoadFrom( AppDomain.CurrentDomain.BaseDirectory + assemblyName );
Anyone can explain ?

>>I have a small exe which runs just fine when i run it as a console app. I converted it into a System Service and installed the service with installutil.
>>
>>The problem is that this exe refers to external dll (located in the same bin directory as the exe) When the exe tries to load one of the dll i get a FileNotFoundExeption. if i copy the dlls to whe winnt\system32 dir, everything is fine. but i don't want to do that.
>>
>>Is there any difference on dependency search path in .Net for service application ? And how could i resolve this without copying the dlls into the system directory or to the GAC ?
>
>Did you try to reference that file with:
>
>
>        lcStartupDirectory = Application.StartupPath + "\"
>
Previous
Reply
Map
View

Click here to load this message in the networking platform