none
How to Find out Windows service application path from Code ? RRS feed

  • Question

  • Dear frnds,

    Could you please help me to find out the path of  windows serivce exe ( application path ) from code?

     

    Regards.

    Sajid P K

     

    Wednesday, September 1, 2010 8:12 AM

Answers

  • You can use System.Reflection.Assembly.GetExecutingAssembly().Location in service code to get the service exe path.

    i am not sure but Application.StartupPath might also return the containing directory path

    Hope it helps.

    • Marked as answer by Sajid P K Thursday, September 2, 2010 5:56 AM
    Wednesday, September 1, 2010 8:55 AM

All replies

  • HI,

    are you looking for Assembly.GetExecutingAssembly().GetName().CodeBase?

    That gives you the exact location of the running assembly.

    With kind regards,

    Konrad

    Wednesday, September 1, 2010 8:48 AM
  • You can use System.Reflection.Assembly.GetExecutingAssembly().Location in service code to get the service exe path.

    i am not sure but Application.StartupPath might also return the containing directory path

    Hope it helps.

    • Marked as answer by Sajid P K Thursday, September 2, 2010 5:56 AM
    Wednesday, September 1, 2010 8:55 AM