473,327 Members | 2,094 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Configuration file

I have created a class library called Employee.dll and created a
configuration file called Convert.config in this project.
What should I use to open this config file:
<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<appSettings>

<add key="employee" value="run batch file"/>

</appSettings>

</configuration>

This is my source code:

Configuration config =
ConfigurationManager.OpenExeConfiguration(Utils.Ge tCurrentAssemblyPath() +
@"\Convert.config");

AppSettingsSection appSettings = config.AppSettings as AppSettingsSection;

But I got exception:

An error occurred loading a configuration file: The parameter 'exePath' is
invalid.

Parameter name: exePath.



Sep 7 '06 #1
2 7754
Alan

You can get the configuration value from the appSettings node using

string value = ConfigurationManager.AppSettings["employee"]

There's no need to instantiate ConfigurationManager.

HTH

Glenn

"Alan T" <al*************@yahoo.com.auwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>I have created a class library called Employee.dll and created a
configuration file called Convert.config in this project.
What should I use to open this config file:
<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<appSettings>

<add key="employee" value="run batch file"/>

</appSettings>

</configuration>

This is my source code:

Configuration config =
ConfigurationManager.OpenExeConfiguration(Utils.Ge tCurrentAssemblyPath() +
@"\Convert.config");

AppSettingsSection appSettings = config.AppSettings as AppSettingsSection;

But I got exception:

An error occurred loading a configuration file: The parameter 'exePath' is
invalid.

Parameter name: exePath.



Sep 7 '06 #2

Look at this post:
http://www.eggheadcafe.com/forumpost...umpostid=85647

for using a non standard config file in 1.1

"Alan T" <al*************@yahoo.com.auwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
I have created a class library called Employee.dll and created a
configuration file called Convert.config in this project.
What should I use to open this config file:
<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<appSettings>

<add key="employee" value="run batch file"/>

</appSettings>

</configuration>

This is my source code:

Configuration config =
ConfigurationManager.OpenExeConfiguration(Utils.Ge tCurrentAssemblyPath() +
@"\Convert.config");

AppSettingsSection appSettings = config.AppSettings as AppSettingsSection;

But I got exception:

An error occurred loading a configuration file: The parameter 'exePath' is
invalid.

Parameter name: exePath.



Sep 7 '06 #3

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

Similar topics

2
by: Alexander Kienzle | last post by:
I'm new to Java programming. I'm developing a Servlet for tomcat which needs an external configuration file. With external I mean a file (in XML format) which is customizable and not contained in...
2
by: kathy | last post by:
What Application Configuration File is? And when/where/how to use it? Any documents on that? MSDN has somrthings scatter everywhere - hard to follow. thanks,
4
by: Jessard | last post by:
Hi Guys and Girls, I have a situation where I am wishing to deploy a .NET dll onto a number of servers. The classes in the DLL will be used by VBScripts. When one of the classes - Connection -...
3
by: Florida Coder | last post by:
I have the need to store some application specific configuration data to be used by a class library and or a windows service. I would like to do this in a fashion similar to the way we do with...
0
by: phillip | last post by:
This is interesting, I have attached my web.config file and the exception I have been logging. I created a library which provide data access to a database and a control system. The library is...
1
by: Ramanfromoz | last post by:
Hi, Developing a new we application. Everything okay on my local WIN XP PROFESSIONAL, IIS 5.0 running locally. The website is running smoothly. Now, the same code I am copying over to a...
10
by: Rider | last post by:
Hi, simple(?) question about asp.net configuration.. I've installed ASP.NET 2.0 QuickStart Sample successfully. But, When I'm first start application the follow message shown. ========= Server...
0
by: sean rogers | last post by:
hello im using the configuration block and have created the main config file for the application - the file that contains the paths to the other configuration sections i.e. - (my other...
6
by: Jeff Hegedus | last post by:
I have a dll that requires some configuration data. I put the configuration data in a custom configuration section in a config file that is loaded in the installation folder of the dll. If I...
3
by: Mike | last post by:
Hi I have problem as folow: Caught Exception: System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: Request for the permission of type...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.