473,651 Members | 2,580 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

regarding the location of config files for the .net windows servic

hi all

i wrote a windows service.
i am trying to get it to use an app.config file.
unfortunately, when the service starts,
it assumes that the ConfigurationSe ttings file
is in C:\Windows\Syst em32.

this is unacceptable to me.
rather, i would like the service to assume that the app.config file is in
the same directory as the .net windows service exe

can i do this?

Thanks

With Regards
Vinoth Kumar.V.K
Nov 17 '05 #1
2 2660
Hi,

As far as I was aware it alreadyu does this? I have written many
service applications using the app.config file and it has always
picked it up correctly from the directory that the EXE was running.
Not sure how it does this as you correctly state the service uses the
c:\windows\syst em32 as it's working directory as it runs wihtin the
svchost.

Have you tried an compile any example services from the net and see if
you get the same problem?

Cheers,

Erik

On Wed, 18 May 2005 23:27:43 -0700, Vinoth Kumar
<Vi*********@di scussions.micro soft.com> wrote:
hi all

i wrote a windows service.
i am trying to get it to use an app.config file.
unfortunatel y, when the service starts,
it assumes that the ConfigurationSe ttings file
is in C:\Windows\Syst em32.

this is unacceptable to me.
rather, i would like the service to assume that the app.config file is in
the same directory as the .net windows service exe

can i do this?

Thanks

With Regards
Vinoth Kumar.V.K


Nov 17 '05 #2
Thinking about it, it you wanted to try setting
Environment.Cur rentdirectory in your onstart event to your working
directory and see if that works?

On Wed, 18 May 2005 23:27:43 -0700, Vinoth Kumar
<Vi*********@di scussions.micro soft.com> wrote:
hi all

i wrote a windows service.
i am trying to get it to use an app.config file.
unfortunatel y, when the service starts,
it assumes that the ConfigurationSe ttings file
is in C:\Windows\Syst em32.

this is unacceptable to me.
rather, i would like the service to assume that the app.config file is in
the same directory as the .net windows service exe

can i do this?

Thanks

With Regards
Vinoth Kumar.V.K


Nov 17 '05 #3

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

Similar topics

8
3109
by: Rim | last post by:
Hi, How can I control the location of the bytecode files? The reason I ask is I want to place the bytecode in a directory different than source code for backup reasons. Our backup system is directory based and I only want to have source code backed up, not object files or pyc files. Thanks,
2
4349
by: Vincenzo Davi | last post by:
I have created a dll with several classes in C#. One of the classes references image files in the subdirectories of the bin/Release folder (basically where the dll resides). Now, I want to use the dll from a C# Windows application. In the class that references the images in the subdirectory, I use the following code to make use of that directory: Environment.CurrentDirectory
5
4944
by: localhost | last post by:
I want to determine within my code-behind only the location of the current tem directory for ym ASP.NET files. For example, the latest web app build on my system shows: "c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\testapp\97e6075d\ca93f565\assembly\dl2\d5f616ee\9e1410d4_0348c401" I know it is dynamic, but I want to determine what the current directory is in-code.
1
1803
by: herbert | last post by:
In VS.2005 a Windows Service can have an app.config file. A class library can also have an app.config file. Now if my Windows Services uses three class libraries, each of it coming with its own app.config file, in which sequence are the app config files read in? eg What happens if there are trace switches of the same name with different values in those files? Or a the config files local to a VS project/assembly ? If so, they should not...
9
2275
by: KarlM | last post by:
After reading some articles regarding confuguration data I'm a bit confused. Where is the right place for storing configuration data? - XML-files? - registry? - INI-files? (from a users point of view, ini-files are more comfortable to read and edit) Where should I store user specific config data? Where should I store machine specific config data?
1
6105
by: phrankbooth | last post by:
Hi, New to windows services, but I've managed to create one and install it successfully. However, I'm confused about what the InstallUtil actually does. I'm not sure if it just registers and configures the service files (exe, dll, config, etc...) as a service or if it copies to a special location like the GAC and runs it all from there, or if the original location of the files is the actual location even after the InstallUtil is done.
1
6444
by: n33470 | last post by:
Hi all, We have an asp.net 1.1 app that we're in the process of converting to 2.0. What I'm about to describe runs just great in the 1.1 framework, but does not work in the 2.0 framework. This app uses forms authentication and denies all unauthenticated users. There is a location override in the web.config so that we can open up a directory for unauthenticated users to create a login account. There is only 1 web.config in the...
1
8589
by: Robert Dufour | last post by:
Changing a setting in the UserSettings from within my app using code (Vs2005 vb.net) does not seem to persist changes to the myapp.exe.config file what is the location and name of the file where the usersettings are persisted? Is there any way to have modifications made in code to application level settings? The my.settings in VS2005 and vb.net 2005 does not permit application level settings to be modified in code cause the geniuses at MS...
8
3161
by: Bill McCormick | last post by:
<!-- When deploying the service library project, the content of the config file must be added to the host's app.config file. System.Configuration does not support config files for libraries. --> I assume "libraries" here to mean DLL's. If that's the case, is there any way to supply both ends of a service (client and host) with the code for the class that describes the contact WITHOUT a duplication in source code? Thanks.
0
8349
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8695
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8460
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6157
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4281
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1906
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1585
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.