473,569 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows Service and app.config

I've created a windows service in C#, but I'm having trouble reading
<appSettings> from a app.config file.

I can read <appSettings> just fine from a normal C# windows app, so there
must be some trick to read this file from a windows service, yes? perhaps
the location of the .config file?

any help is appreciated...
-bill
Nov 16 '05 #1
2 2484
I don't think app.config is designed to work with a dll (or a service).
You can store the configuration in an Xml (you'll do the parsing)
or in the registry.

--

This posting is provided "AS IS" with no warranties, and confers no rights.
"Bill" <ws*******@ucsd .edu> wrote in message
news:uQ******** ******@TK2MSFTN GP11.phx.gbl...
I've created a windows service in C#, but I'm having trouble reading
<appSettings> from a app.config file.

I can read <appSettings> just fine from a normal C# windows app, so there
must be some trick to read this file from a windows service, yes? perhaps
the location of the .config file?

any help is appreciated...
-bill

Nov 16 '05 #2
Nal
App.config works just fine with Windows Services, there is no need for a
custom xml file.
"S. Han" <@> wrote in message news:40******@n ews.microsoft.c om...
I don't think app.config is designed to work with a dll (or a service).
You can store the configuration in an Xml (you'll do the parsing)
or in the registry.

--

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

"Bill" <ws*******@ucsd .edu> wrote in message
news:uQ******** ******@TK2MSFTN GP11.phx.gbl...
I've created a windows service in C#, but I'm having trouble reading
<appSettings> from a app.config file.

I can read <appSettings> just fine from a normal C# windows app, so there must be some trick to read this file from a windows service, yes? perhaps the location of the .config file?

any help is appreciated...
-bill


Nov 16 '05 #3

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

Similar topics

5
6739
by: | last post by:
Hi, I have a Windows Service that uses a referenced dotnet-dll. In my dll I set some public string to a stringvalue that I get from reading a xml-file(my config file). It works fine if I use it in a vb-form. But since Windows Services ? executes? in windows\system32 I can´t locate my xml-config- file. I don´t want to set different...
1
5973
by: Vlad | last post by:
Is there any way to install multiple instances of the same windows service designed with VS.NET 2003? I tried copying the binaries into a separate folder and then copying registry entries for the original service under a new name but the SCM complains that the executable does not have this service implemented. Please note that I need to have...
2
7268
by: Fadi | last post by:
Backround: I am trying to figure out how to do the equivalant of a classic COM Local Server Singleton in .NET/C#. I created a coupld of simple Class Libs that exposes public interfaces and hosted them in a Windows Forms EXE. Create a Windows Forms client and both the Client and the Host EXEs configure the remoting protocols through...
2
2660
by: Vinoth Kumar | last post by:
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 ConfigurationSettings file is in C:\Windows\System32. this is unacceptable to me. rather, i would like the service to assume that the app.config file is in
6
3793
by: Leonardo Curros | last post by:
Hello, I would like to know what's the best way to restart one service. I would like to do it from the service itself. Is this possible? I try it with ServiceController.stop() ServiceController.WaitForStatus(ServiceControllerStatus.Stopped) ServiceController.start() but doesn´t works. It seems waitforstatus instruction is the last
3
1489
by: John Fred | last post by:
Salve, I have write a service Windows for the remoting. I have a dll Server (OLD COM+) For Configure DLL Server I user Config File Es. <configuration> <system.runtime.remoting> <application>
4
22518
by: PeterW | last post by:
I have a Windows service that needs to get some values from a config file. I place the config file for the service in the System32 directory. I do not get the values using the usual ConfigurationSettings.AppSettings Any tips please cheers -- PeterW
4
3406
by: =?Utf-8?B?QmlsbCBNaWxk?= | last post by:
Feel free to let me know if there is a better place to post this question I'm a website developer trying to write a Windows Service, and I think I'm running into trouble due to the paradigm shift. In website development, I change the web.config file on the fly without re-building a project. How does this work with the app.config in a...
14
5583
by: Peter | last post by:
..NET 3.5 I have a Windows Service application and it does remoting, but when a client incounters an error the client get the following error message "Server encountered an internal error. For more information, turn off customErrors in the server's .config file." Where do I turn this off
1
2075
by: =?Utf-8?B?TWFuanJlZSBHYXJn?= | last post by:
Hi, I created a web service that I want to host in windows service. The problem is that if I host it as windows service it does not use the configuration file. I have to define the binding, endpoint etc. programmatically in the Program.cs file. Any idea what I might be doing wrong? Cheers,
0
7612
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...
0
8120
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...
0
7968
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6283
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5512
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...
0
5219
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...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
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...

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.