473,383 Members | 1,795 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,383 software developers and data experts.

The key 'SecurityKey' does not exist in the appSettings configuration section.

Winform / C# / SQL

I get this error when I try to run my program:
The key 'SecurityKey' does not exist in the appSettings configuration section.

More accurately the program runs and the login form appears but when I attempt to login it tries to access a "Key" in app.config page but it can't seem to find it.

This is the line that is looking for the Key:
string key = (string)settingsReader.GetValue("SecurityKey", typeof(String));

The thing is that when I build and run the program it runs fine but if I try to run it from the .exe in the \bin\Debug folder I get the above mentioned error.

I believe it's referring to one of my classes:
<appSettings>
<add key="SecurityKey" value="Key goes here" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>

I found on this site someone that had the same error and they found the problem was that XML is case sensitive and the person had <appsettings> instead of <appSettings>
and that worked for him but I went through my application and I couldn't find any similar problem.

Am I not supposed to use the .exe in the deb \bin\Debug folder perhaps?

Any help is much appreciated.

~ Chris
Mar 26 '11 #1
2 5917
Plater
7,872 Expert 4TB
Be sure your project is set to Debug (and not Release) and do a full build.
It is also possible that the "startup path" is the culprit, depending on how you run your exe, it might be looking for the file in the wrong place.
Is the xml file in the same directory as the exe?
Apr 12 '11 #2
Hi Plater, thanks for the input, it's a little embarrasing but what happened was that I hadn't created my setup projet yet and I was just using the .exe from the projects debug folder. It should have still worked but what I had done was copied the .exe to my desktop (like I said, 'a little embarrasing'). The exe contained most of the needed files but the .xml was external.

I'm a little new to this and once I did some research I found out how to build a project properly and create the proper installation files all seemed to work well.

Thanks for your input, I do appreciate the people that help in these forums.

~ Chris
Apr 12 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Thomas Koch | last post by:
Hi there - I have created my own implementation of System.Configuration.IConfigurationSectionHandler in order to have a special configuration section in an App.Config file that configures my...
2
by: hazz | last post by:
I have spent more time than I care to admit trying to track down a very subtle error. Here is my app's xx.exe.config file. <?xml version="1.0" encoding="utf-8" ?> <configuration>...
2
by: Susan | last post by:
I have a form (frmHelp) with a helpProvider on it. I have set the keyword for the text box on this form as dynamic (frmHelp.textBox1.HelpKeyword). I created a inherited form from frmHelp called...
5
by: Prince | last post by:
Hai all, I got this exception in my application and that occurs in the follwing line.. Trace.WriteLine("Text"); {@"Exception in configuration section handler (D:\Program...
2
by: Alpha | last post by:
I'm getting the following error message when I run my C# Window Application from other PC (not my development machine). Can someone tell me how to correct this appSettings Configuration problem?...
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...
1
by: Jess Chadwick | last post by:
I am attempting to use the Enterprise Library (Jan 2006) Cryptography block to encrypt a credit card number in my ASP.NET 2.0 Commerce Server application. Everything is configured correctly, as...
0
by: style | last post by:
In the following sample I declared a custom configuration section within my app.config. As you can see, the lastName attribute of the second employee element is missing: <?xml version="1.0"...
7
by: =?Utf-8?B?RG91Z2llIEJyb3du?= | last post by:
Hi I've written custom configuration section (inherits from System.Configuration.ConfigurationSection) to simplify the contents of the config file and to make life easier when accessing them in...
0
by: Paul Buckley | last post by:
Hi, I'm trying to gain access to a configuration section from within an assembly that has been loaded using Assemly.Load(byte). There is one main exe (lets say myApp.exe) and one config file...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.