467,169 Members | 1,004 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,169 developers. It's quick & easy.

windows service path

I have created a windows service
that service downloads updated database after regular intervals
till now i am setting path in app.config where it will download database and
will use it from that location
i want it to dynamically take path of folder where that service will get
installed
i don't have any idea abt remoting
so pls help me by telling something more exact abt this
Sep 2 '06 #1
  • viewed: 2118
Share:
3 Replies
You might want to look at Assembly.GetExecutingAssembly() and work out
where the assembly is, so you can make a path relative to that. (You
can find the path using
Assembly.GetModule(), then Module.FullyQualifiedName.)

"Vikas Kumar" <ef*****@newsgroups.nospamwrote in message
news:eX**************@TK2MSFTNGP04.phx.gbl...
>I have created a windows service
that service downloads updated database after regular intervals
till now i am setting path in app.config where it will download database
and will use it from that location
i want it to dynamically take path of folder where that service will get
installed
i don't have any idea abt remoting
so pls help me by telling something more exact abt this

Sep 2 '06 #2
Hello Vikas,

Do you think Ankit's suggestion on using the
Assembly.GetExecutingAssembly() to get the executing assembly(it is the
windows service's exe image for your windows service case) and use its
"Location" or "CodeBase" property to get the physical path information.

BTW, if the path you want to use is fixed after you installed the windows
service(its assembiles) on the target machine, you can also consider create
a setup program for the windows service and get the installed location of
the application(in programfiles folder...) and write it in your servcie
application's app.config file. Do you think this also workable?

Please feel free to post here if you have any further question on this.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 4 '06 #3
Hi Vikas,

Have you got any progress on this issue or does the information in our
previous reply helps some? If there is anything else we can help, please
feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 6 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Eric Chong | last post: by
6 posts views Thread by Laszlo Zsolt Nagy | last post: by
2 posts views Thread by Buddhi | last post: by
10 posts views Thread by Ger | last post: by
reply views Thread by Jason | last post: by
reply views Thread by =?Utf-8?B?U2ltb25EZXY=?= | last post: by
12 posts views Thread by Anil Gupte | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.