473,322 Members | 1,307 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

application path of a service

Hello everyone,

This is probably a very simple and stupid question, but I cannot seem to
find the answer to it. How do I obtain the path of a windows service's
executable file? The Application.StartupPath does not work of course, since
the system.windows.forms assembly is not loaded. I tried
Environment.CurrentDirectory and System.IO.Directory.GetCurrentDirectory,
but they echoed the system32 directory.

Thanx,

Dmitry
Jul 21 '05 #1
3 10465
Try:

System.Reflection.Assembly.GetExecutingAssembly.Lo cation
-----Original Message-----
Hello everyone,

This is probably a very simple and stupid question, but I cannot seem tofind the answer to it. How do I obtain the path of a windows service'sexecutable file? The Application.StartupPath does not work of course, sincethe system.windows.forms assembly is not loaded. I tried
Environment.CurrentDirectory and System.IO.Directory.GetCurrentDirectory,but they echoed the system32 directory.

Thanx,

Dmitry
.

Jul 21 '05 #2
Hello,

"Dmitry Akselrod" <dm*****@ddi.com> schrieb:
This is probably a very simple and stupid question, but
I cannot seem to find the answer to it. How do I obtain
the path of a windows service's executable file?


Maybe 'System.Reflection.Assembly.GetExecutingAssembly() .Location' works
(untested).

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Jul 21 '05 #3
That worked like a charm. Thank you so much!

Dmitry

"Herfried K. Wagner [MVP]" <hi*******@m.activevb.de> wrote in message
news:eO***************@TK2MSFTNGP12.phx.gbl...
Hello,

"Dmitry Akselrod" <dm*****@ddi.com> schrieb:
This is probably a very simple and stupid question, but
I cannot seem to find the answer to it. How do I obtain
the path of a windows service's executable file?


Maybe 'System.Reflection.Assembly.GetExecutingAssembly() .Location' works
(untested).

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Keith | last post by:
All, I have been told this is an ASP.NET issue and not an IIS issue, so I am posting this here. I have a problem with ASP.NET returning an HTTP 500 error when trying to run ASPX pages on...
5
by: Martin Robins | last post by:
I have never dabbled with ASP.NET until now so be warned! I have created a web application with the single default form: WebForm1.aspx and when I try to display it I get this error. My...
2
by: Ross | last post by:
Hi I have an application using asp.net that I am running on my PC. The web form has a text box where you can enter a name for a new Photo category then click on the button. The code is...
20
by: J-T | last post by:
We are working on an asp.net application which is a 3-tier application.I was aksed to create a component which monitors a folder and gets the file and pass them to a class library in our business...
1
by: Zachariah | last post by:
I created a Windows Service and part of its functionality is to move a PDF file from a location on the service's local drive stInPath (C:\PDF\) to a location on another server stOutPath...
13
by: Nak | last post by:
Hi there, In VB6 if I wanted to make a shared application so to speak I would create an ActiveX EXE. This would allow me to expose objects of the application but only have 1 instance loaded. ...
4
by: Ray | last post by:
Does anyone out there have experience with using Db2 8.2 with a program called MISys (also known as ACCPAC). I am having some problems with the application running exteremly slow on workstations...
12
by: Martyn Fewtrell | last post by:
Hi there I'm trying to find the correct way to write exceptions to the Application log using Vb.Net. I've done a fair bit of Googleing and although this gets plenty of mentions and that this...
2
by: loga123 | last post by:
Hi All, I have 2 web applications running on the same IIS server with different roots. Suppose, application A can be run using --http://localhost/A application B can be run using...
4
by: =?Utf-8?B?S2lt?= | last post by:
Hey All I know how to to get the service ( by RegistyKey and Registy) so I can start the Application by dobble ckich on the file, but how can I read (and save) the path to the file so I can save...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.