Very strange problem
I have windows service, that using information from inside App.config by
ConfigurationSe ttings.AppSetti ngs["ConfigPath "] <- Everything is ok here
BUT, once I want to read string such as
<add key="ConfigPath " value="%my_home _dir%\config\fi le.xml" />
or
<add key="ConfigPath " value="C:\Progr am
Files\MyApplica tion\Sinfo\conf ig\file.xml" />
it failed on "Illegal String exception"
Once using THE SAME string from INSIDE service - works file, but from
App.config failed.
Notice1: The same string from App.config works fine from Console Application
Notice2: Tried to save myservice.exe.c onfig in service directory and in
System32 directory as well. The same problem.
Notice3: Other string I can read without problems
What is the problem, as I missing something?
--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us " 7 1461
>Very strange problem Once using THE SAME string from INSIDE service - works file, but from App.config failed.
Can you show us your WHOLE app.config file???
Marc
=============== =============== =============== =============== ====
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)i nova.ch
<?xml version="1.0" encoding="utf-8" ?>
<configuratio n>
<appSettings>
<!-- placement of MyApp configuration file-->
<add key="MyAppPath" value="C:\Progr am
Files\MyApp\Ser verDirector\con f\manager.xml" />
<!-- addins to Manager directory in site-->
<add key="ManagerDir " value="manager" />
<!-- number of failures req'd to perform automatic IIS Out-Of-Process Pooled
Applications unload. Set to "0" for "never"-->
<add key="OOPUnload" value="1" />
etc..
--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "
"Marc Scheuner [MVP ADSI]" <m.********@ino va.SPAMBEGONE.c h> wrote in message
news:7j******** *************** *********@4ax.c om... Very strange problem Once using THE SAME string from INSIDE service - works file, but from App.config failed.
Can you show us your WHOLE app.config file???
Marc =============== =============== =============== =============== ==== Marc Scheuner May The Source Be With You! Bern, Switzerland m.scheuner(at)i nova.ch
Thanks for the app.config file - don't see anything wrong with it. I have windows service, that using information from inside App.config by ConfigurationS ettings.AppSett ings["ConfigPath "] <- Everything is ok here
I don't quite understand - you *can* read something from the
app.config file, from within your service, at first??
I was just thinking that maybe the service doesn't find the app.config
file, or the ConfigurationSe ttings object might be NULL, or something
like that..... hmm......
Can you read those settings from a "regular" windows apps??
Marc
=============== =============== =============== =============== ====
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)i nova.ch
Thank you for response:
Thanks for the app.config file - don't see anything wrong with it. Me too :)
I don't quite understand - you *can* read something from the
app.config file, from within your service, at first??Yes, except the first string
Can you read those settings from a "regular" windows apps??Yes
--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "
"Marc Scheuner [MVP ADSI]" <m.********@ino va.SPAMBEGONE.c h> wrote in message
news:ka******** *************** *********@4ax.c om... Thanks for the app.config file - don't see anything wrong with it.
I have windows service, that using information from inside App.config by ConfigurationS ettings.AppSett ings["ConfigPath "] <- Everything is ok here
I don't quite understand - you *can* read something from the app.config file, from within your service, at first??
I was just thinking that maybe the service doesn't find the app.config file, or the ConfigurationSe ttings object might be NULL, or something like that..... hmm......
Can you read those settings from a "regular" windows apps??
Marc =============== =============== =============== =============== ==== Marc Scheuner May The Source Be With You! Bern, Switzerland m.scheuner(at)i nova.ch
Hi Tamir,
First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you cannot get string values from the
app.config file in a Windows Service application. If there is any
misunderstandin g, please feel free to let me know.
Based on the app.config file you have provided, I cannot see any problem
either. I have also put the app.config file in a Windows Service project,
however, I cannot reproduce the problem. Could you show us the code you're
accessing the configuration setting and in which event the code is?
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
m_xmlpath = ConfigurationSe ttings.AppSetti ngs["MyAppPath"];
--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "
"Kevin Yu [MSFT]" <v-****@online.mic rosoft.com> wrote in message
news:aV******** ******@cpmsftng xa06.phx.gbl... Hi Tamir,
First of all, I would like to confirm my understanding of your issue. From your description, I understand that you cannot get string values from the app.config file in a Windows Service application. If there is any misunderstandin g, please feel free to let me know.
Based on the app.config file you have provided, I cannot see any problem either. I have also put the app.config file in a Windows Service project, however, I cannot reproduce the problem. Could you show us the code you're accessing the configuration setting and in which event the code is?
Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
Hi Tamir,
With the code and app.config file, I still cannot reproduce the problem on
my computer. I think this problem might relate with the environment on your
computer and how the windows service was installed onto your machine.
Please also use FileMon to check if the .EXE file has refer to the correct
.config file. FileMon can be downloaded from the following link: http://www.sysinternals.com/ntw2k/source/filemon.shtml
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights." This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Maxim Khesin |
last post by:
I want to have a config file with my python proggie, satisfying the
following requirements:
1) support key->(value, default)
2) simple and intuitive to read and edit
3) easyly readable into a python datastructure (a dictionary?)
4) not requiring any heavy libraries needed (I am distributing my
proggie as a py2exe executable and do not want to bloat the size)
can you guys suggest some format for this? thanks,
max
|
by: Ant Corrie |
last post by:
I am at a loss as to why this is not working. I am trying to setup a
TextWriterTraceListener in my application config file and then execute the
app from the network. I get a security exception (listed below) even though
I have StrongNamed my application and used the .NET Configuration Tool to
create a Code Access Group in the Machine Policy that gives FullTrust to
assemblies with the StrongName that I created.
If you uncomment the code...
|
by: Kevin Newman |
last post by:
I have a situation, where I'd like to dynamically create a function in
the global space (window.funcWillGoHere) and have it call a method (or
private function) of an instantiated object that it will not know the
name of.
I came up with this:
dude = function() {
function dudely() {
alert('dudely');
|
by: vkrasner |
last post by:
It works with VS2003 and does not in VS2005:
in VS2003 :
string sMyvalue = ConfigurationSettings.AppSettings;
in VS2005 (does not work!!)
string sMyvalue = ConfigurationManager.AppSettings;
Anybody able to give me idea how-to read by C# element which I add to the
machine.config into the new single section?
|
by: Manuel Arias |
last post by:
Hello everyone
I am having a bit of a problem reading a configuration
file for an app host via IE. If I make a simple .net app
with just a button that calls a function in a class
library that returns a string from the configuration file
it works fine. But it isn't the case all the time.
Sometimes, some of my dlls just will not read from the
config file. What is even stranger is if I purposely place
an error inside the .config file the...
| |
by: Sridhar |
last post by:
Hi,
I have created a project which contains classes to read the data from the
database. This project has an App.Config file which contains the
SqlConnection String. when this code is called from a web application and if
I need to read the connection string it is reading the connection string from
the web.config of web application. I am not knowing how to change the
Application domain so that it reads the App.config file instead of...
|
by: Keith |
last post by:
Hello all,
I have a C# Windows Forms app. It is in namespace App.GUI. It builds to Nav.exe. I have entered an application level setting using the designer. Its type is string, name is "FOO" and value is "monkey". I've tried the following ways to retrieve the value and only one works:
//Returns null
Configuration config = ConfigurationManager.OpenExeConfiguration(Assembly.GetEntryAssembly().Location);
string monkey =...
|
by: eagle |
last post by:
I have a web.config in my application that contains the connection strings
to all my datasources. I want to move these connection strings to another
web config up the folder hierarchy so that all my apps can use the same
connection strings. That is supposed to be how it's done, no? Instead of
the web.config being in c:\inetpub\wwwroot\myApp\web.config, I have it in
c:\inetpub\wwwroot\web.config. However, I get an "Object reference not...
|
by: Johnson |
last post by:
I'm trying to fix a "sub optimal" situation with respect to connection
string management. Your thoughtful responses will be appreciated.
I just started with a new client who has a bunch of legacy ASP.NET
applications that all manage connection strings in Web.config the same way,
like this:
This client has one Web.config file per application, and that one Web.config
file is duplicated across all environments (i.e., dev machines, test,...
|
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...
|
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,...
| |
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...
|
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,...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |