473,836 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

app.config & Win Service

I have an assembly, which is reading some values from the
App.Config file. It works fine when used with a Win Forms
project.

Now I am trying to use the same assembly in a Windows
Service Project but the service fails to start as the
assembly is not able to get the value from the app.config
and hence throws an error. I tried adding app.config to
the Win Service Project but it did not work.

Rajesh Abraham
Nov 15 '05 #1
2 2069
Hi,

The thing is that the service runs from C:\Windows\Syst em32 , I think that
you can solve it settig the current directory to your specific directory:

System.IO.Direc tory.SetCurrent Directory(
System.IO.Path. GetDirectoryNam e(Process.GetCu rrentProcess(). MainModule.File N
ame ) );

This should solve your problem.

hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Rajesh Abraham" <ch******@hotma il.com> wrote in message
news:08******** *************** *****@phx.gbl.. .
I have an assembly, which is reading some values from the
App.Config file. It works fine when used with a Win Forms
project.

Now I am trying to use the same assembly in a Windows
Service Project but the service fails to start as the
assembly is not able to get the value from the app.config
and hence throws an error. I tried adding app.config to
the Win Service Project but it did not work.

Rajesh Abraham

Nov 15 '05 #2
Thanks for the response. It worked but I was making one
more mistake. I had copied the app.config from my other
project and added it to the solution but it did not work
even after renaming to MyNewApp.exe.co nfig. Finally I had
to add a new text file into the solution and add rename it
as app.config and copy the contents into it and build the
solution again.

Thanks,

Rajesh Abraham
Nov 15 '05 #3

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

Similar topics

2
4160
by: Darwin Fisk | last post by:
I have an app that is deployed that uses .config file settings. I have an update of that app that I am installing using a setup and deployment project. The basic setup process works fine. Now I want to get a little fancier. I need to have the setup process check for the existence of the .NET Framework and install it if it is not present. How do I do this? To carry this even a step further, how do I detect the VERSION of .NET...
2
2051
by: Yosh | last post by:
Morning! I am developing an winform application in c#. I have an app.config file that contains an entry with a Url address assigned to it. When I run my application I get the following error: The ':' character, hexadecimal value 0x3A, cannot be included in a name. After doing some research, the problem is not the semi-colon. It's the ampersand in the Url that is causing the error.
4
17082
by: TomB | last post by:
I've written a simple service that reads the app.config file on start. It works fine if I start it from the VS IDE -- F5 then installutil I then created a package, wherein the content of app.config has "" for the values. With the idea that my user, can enter the information before starting the service. However; this doesn't work. I'm very confused. As a test, I "emptied" the app.config file and rebuilt, then did an installutil. ...
6
2372
by: Ruslan | last post by:
Hello, I have to project: one ASN.NET project and another - Web Service in the same solution. I want to use the same web.config and global.asax files. Does it possible?
0
1811
by: Laura Papez | last post by:
(note: orginally posted to the dotnet.framework.webservices.enhancements folks - thought this group may have more experience in this area. Ta, Laura.) Hi, I have created a secure Web Service via WSE with the use of WS-Policy. The Web Service has been tested using a .NET client Console Application and everything works. However, the Web Service needs to be called from a VB6 application (running
17
3257
by: Fred Nelson | last post by:
Hi: I have written several web applications that obtain their connection strings from the web.config file. This is very easy to use and it makes it easy to move an app from development into production. I'm in the process of writing a site that will have lots of traffic so I'm trying to save resources everyplace that I can. My question is - do the web.config app settings get loaded once when the
1
2042
by: Max | last post by:
hi i have stored my connction string in web.config as we do usually. code of web.confing is given below. check the password field contain "&" character. now when i run my application it gives error because value of ConnectionString is breaked at "&". So how to store value in web.config that contain "&" character, if any
0
6751
by: Vijay | last post by:
Prep Courses for International Certifications, CSTE & CSQA & ISEB & ISTQB &Business Analyst & SOA Certifications in HYDERABAD. After receiving overwhelming response to our last 50+ batches, SPECTRAMIND SOLUTIONS now announces a new batch of Prep Courses for CSQA & CSTE& ISEB & ISTQB & Business Analyst & SOA so as to prepare you thoroughly for the most prestigious certification exams conducted by International organizations. We...
0
2573
by: Gauls | last post by:
Hi, I have webservice application that uses some assemblies whoes version number keeps changing and are stored in some folder on the same machine as my webservice. Every Time the assembly version changes i need to change the binding redirect and code base in the web.config file. EX : <dependentAssembly> <assemblyIdentity name="ABCD" publicKeyToken="Sometoken" culture="neutral" />
0
9810
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
9656
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,...
1
10570
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,...
0
10240
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9355
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7772
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
5811
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4438
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4000
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.