Questions tagged [app-config]

.NET application configuration files contain settings specific to an application.

Application configuration files contain settings specific to an application. This file contains configuration settings that the common language runtime reads (such as assembly binding policy, remoting objects, and so on), and settings that the application can read.

The name and location of the application configuration file depend on the application's host, which can be one of the following:

Executable–hosted application.

The configuration file for an application hosted by the executable host is in the same directory as the application. The name of the configuration file is the name of the application with a .config extension. For example, an application called myApp.exe can be associated with a configuration file called myApp.exe.config.

While developing with Visual Studio the file app.config in a project will be copied to the correctly named configuration file when the project is built.

The file can contain both framework defined and user defined elements (possibly using .NET types to read and write the content).

ASP.NET-hosted application.

ASP.NET configuration files are called web.config. Configuration files in ASP.NET applications inherit the settings of configuration files in the URL path. For example, given the URL http://www.example.com/aaa/bbb, where http://www.example.com/aaa is the Web application, the configuration file associated with the application is located at www.example.com/aaa. ASP.NET pages that are in the subdirectory bbb use both the settings that are in the configuration file at the application level and the settings in the configuration file that is in bbb.

For more information about ASP.NET configuration files, see ASP.NET Configuration

Internet Explorer-hosted application. If an application hosted in Internet Explorer has a configuration file, the location of this file is specified in a tag with the following syntax:

<link rel="ConfigurationFileName" href="location">

In this tag, location is a URL to the configuration file. This sets the application base. The configuration file must be located on the same Web site as the application.

3121 questions
1
vote
0 answers

RIA Services why does VS 2010 not generate an App.config when there is no EF model?

We always generate our RIA services as a "WCF RIA Services Class Library". When we generated one for POCO, without first adding an EF model, we noticed the App.config was not generated. After testing we found the settings are only added to…
iCollect.it Ltd
  • 92,391
  • 25
  • 181
  • 202
1
vote
2 answers

'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll, System.Configure already included

I have a Windows Form application in VS 2013 and I'm trying to establish a database connection. Every time I run the program, however, I receive the following error: An unhandled exception of 'System.Configuration.ConfigurationErrorsException'…
Adam Freymiller
  • 1,929
  • 7
  • 27
  • 49
1
vote
1 answer

ConfigurationSection properties cannot be edited when locked

I thought I had this problem licked yesterday, I got it working by change the order of my operations. Create new section Add elements to section Add section to config config.Save() But today I am getting the same error again on the call to…
Darrel Lee
  • 2,372
  • 22
  • 22
1
vote
0 answers

Rewrite WCF binding from app.config to code

I try rewrite WCF custom binding from app.config to code. App.config
rco
  • 325
  • 4
  • 13
1
vote
3 answers

C# - The configuration section was not found error using aspnet_regiis.exe

I am trying to Encrypt sensitive connection string information inside my app.config file for a C# applicaiton that I am developing. I am using the following command from the VS command promt running as administrator: aspnet_regiis.exe -pef…
Hooplator15
  • 1,540
  • 7
  • 31
  • 58
1
vote
4 answers

c# embed config file within exe

I have a console program 'A' that at a given point will run program 'B' and program 'C'. However I'm having an issue with the app.config associate with each of the program. Basically program A is just a wrapper class that calls different console…
civic.sir
  • 400
  • 1
  • 9
  • 26
1
vote
1 answer

ConfigurationManager gives a TypeInitializationException instantly

I am making an application that needs to read its config file for its settings. I've defined the settings in the App_config file like so:
Bert
  • 113
  • 1
  • 2
  • 8
1
vote
1 answer

Can ConfigurationElementCollection object contain for its elements another ConfigurationElementCollection objects?

Can ConfigurationElementCollection object contain for its elements another ConfigurationElementCollection objects? I have this xml where testsection is section root:
ztepsic
  • 23
  • 1
  • 9
1
vote
1 answer

ExeConfigurationFileMap not finding section in file but ConfigurationFileMap is

Finding a custom section in a config file works when I use a path to a file, but when I pass in an exe config file map of the same thing it fails. Why? string file = System.Reflection.Assembly.GetAssembly(typeof(PhotoComparison)).Location +…
Neil Walker
  • 6,400
  • 14
  • 57
  • 86
1
vote
1 answer

C# modify app.config

i want to change application settings at runtime, here part of it: http://localhost/test/service.asmx
eba
  • 673
  • 2
  • 11
  • 22
1
vote
0 answers

Versioning for binding redirect in app.config .Net

I have binding redirect section in my app.config file.
1
vote
2 answers

WebHttpBinding in WCF: how to configure it the proper way?

Trying to follow this example to make it work: http://weblogs.asp.net/kiyoshi/archive/2008/10/08/wcf-using-webhttpbinding-for-rest-services.aspx Here is my App.config: