Solved

How do I read an .ini-file with a Win service on Windows7

Posted on 2010-11-24
2
327 Views
Last Modified: 2012-05-10
I have installed my Service and the .exe-file is located in C:\Program Files (x86)\MyService. I want to read some values from a .ini-file that also should be located in the same folder.

I have previously used the following code to  read file in the same folder as the service exe-file : path = Environment.CurrentDirectory + "\\Mysettings.ini";

When I debug the service I can see that Mysettings.ini must be located in c:\windows\syswow64 to get it to work. What other code than  Environment.CurrentDirectory should I use to get the right path ?
0
Comment
Question by:Mackey_man
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
buraksarica earned 500 total points
ID: 34206304
try AppDomain.CurrentDomain.SetupInformation.ApplicationBase
0
 

Author Comment

by:Mackey_man
ID: 34206421
Thanks a lot !
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question