471,357 Members | 1,193 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,357 software developers and data experts.

Determine application directory in a Windows Service

I need to programatically determine the directory that the application/service is running from. If I use
Environment.CurrentDirectory it returns the System32 directory. Is there anyway to get this the correct directory?

Jul 21 '05 #1
3 3952
Request.ApplicationPath

Ibrahim ULUDAG
www.ibrahimuludag.com
--
"Buddy Ackerman" <bu**********@buddyackerman.com> wrote in message
news:eZ**************@TK2MSFTNGP09.phx.gbl...
I need to programatically determine the directory that the
application/service is running from. If I use Environment.CurrentDirectory
it returns the System32 directory. Is there anyway to get this the correct
directory?

Jul 21 '05 #2
Request.ApplicationPath

Ibrahim ULUDAG
www.ibrahimuludag.com
--
"Buddy Ackerman" <bu**********@buddyackerman.com> wrote in message
news:eZ**************@TK2MSFTNGP09.phx.gbl...
I need to programatically determine the directory that the
application/service is running from. If I use Environment.CurrentDirectory
it returns the System32 directory. Is there anyway to get this the correct
directory?

Jul 21 '05 #3
Try:
System.Reflection.Assembly.GetExecutingAssembly(). CodeBase
or
System.Reflection.Assembly.GetExecutingAssembly(). Location

whichever you prefer for your situation. That will tell you where your
..NET service executable is.
Buddy Ackerman wrote:
I need to programatically determine the directory that the
application/service is running from. If I use
Environment.CurrentDirectory it returns the System32 directory. Is
there anyway to get this the correct directory?

Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Web Webon | last post: by
1 post views Thread by Keith | last post: by
9 posts views Thread by Wayne Wengert | last post: by
21 posts views Thread by Chris | last post: by
4 posts views Thread by casper | last post: by
7 posts views Thread by Bolwerk | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.