app-config

The problem with NUnit and app.config

When i run a simple test on connection to DB check i receive an error in NUnit: [Test] public void TestConn() { string connectionString = ConfigurationManager.ConnectionStrings["FertigungRead"].ConnectionString; SqlConnection connection = new SqlConnection(connectionString); connection.Open(); Assert.AreEqual(Connectio...

WCF service fails to start when more than one service is available.

I am running a WCF service from inside a exe (for debugging, it will be moved to the windows service when deployed) I got one service running fine inside of it however when I run a second service I get the exception System.InvalidOperationException was unhandled Message=The ChannelDispatcher at 'http://backupsvr:8082/' with contract(s...

Settings end up in user.config even though they are unmodified as read from app.config

Consider a C# app which has a number of user settings, some are actively used and updated and others are always read-only. Under which circumstances can such a read-only settings property end up in a per user maintained user.config? I am seeing a funny behavior that several user configuration settings that app merely reads end up in use...

How do you load the app.config file into a DLL

So I cant find a definitive answer to the Question. How do you load the app.config file into a DLL. I understand that generally the App.config info should be put into the executable app.config. However i am building an add-in and have to executable available. I would like to use the namespace.dll.config file to store my variables, bu...

WPF: Changing config file user settings at runtime?

Hey I'm trying to change some config file user settings values in my WPF application, but its only working partly. The value is changed correctly and the program runs fine with the value. I can even restart the program and the value is still the one i changed it to. The problem is that when i open the .exe.config file the value is still...

.Net Custom Configuration Section and Saving Changes within PropertyGrid

If I load the My.Settings object (app.config) into a PropertyGrid, I am able to edit the property inside the propertygrid and the change is automatically saved. PropertyGrid1.SelectedObject = My.Settings I want to do the same with a Custom Configuration Section. Following this code example (from here http://www.codeproject.com/KB/vb/...

Instantiate a ConfigurationSection from a different source

Is it possible and how to instantiate a custom System.Configuration.ConfigurationSection derived class from a different source (not dependent on App.config)? Here is what i want to get: [TestMethod] public void WorkWithALoadedConfiguration() { ProjectConfiguration projectConfiguration = LoadProjectConfiguration(filenameOrStreamOrXE...

Configuring ASMX Web Service End Points - web.config

I have set up references to 2 web services in a separate assembly TestProj.Core. I reference this Project in a Web Application Project called TestProj.Web. When I setup the references in TestProj.Core the wizard gave me an app.config and through an application settings section into it. How do I get these settings to my web app? Copy an...

How to store an ItemsSource for an ItemsControl (ListBox, ComboBox) in the app.config?

After much research and trial and error I found how to store the items for a ListBox and ComboBox in the app.Config. I am heavily indebted to Jon Rista, who wrote a series of articles about the Net 2.0 Configuration classes. I constructed a (large!) code snippet that will generate all the code you need by just inserting three strings! En...

Weird behaviour of the app.config deployment after updating it.

I moved some hardcoded settings to a custom Section (so I did not use the <appSetting> tag) in the app.config of my ClickOnce application. When updating, the clients got an error stating that the server gave a 404 not found error for the file "myapp.exe.config.deploy". Browsing on the server I did find the changed app.config there, only...

"Unrecognized configuration section connectionStrings" in app.exe.config

Hi On a Terminal Server install of my .NET 2.0 WinForms app, one of my clients gets the following exception on startup: "Unrecognized configuration section connectionStrings" This is occurring in myapp.exe.config but I can't figure out why. Runs perfectly everywhere else, only difference between this install and any other is the connect...

How to check where .NET ConfigurationManager is looking for a .config file?

I'm building a plugin assembly and I would like to provide an accompanying config file. Deployed assembly is probably copied somewhere, don't know where, and would like to know where does the ConfigurationManager looks for a .config file. I do not wish to load .config from an explicit location, just put it where it is being looked for....

cakephp how to set base path

hi How do I set the root of the application? What I mean, is that when I work locally, everything is under the root of my local website (i.e www.in cake.local/). Now I made an application that will not be at the root of a website (i.e. www.outsite.com/sciences/biology/here_is_my_app). Is there a way to make absolute URL in my app p...

Writing custom sections into app.config

I want to save some custom data into application configuration file and I need to create some custom sections in app.config. Reading custom data from app.config is simple task, but I can't write information from my programm into app.config. For finding solution of this problem I create test project. For reading data from custom section ...

Give app.config another name after build?

As you all know, when you build a project with an app.config file it gets copied to the bin directory and renamed $(targetFileName).config. Is it possible for it to be called something else? For example if my executable is called myApplication.exe, can I have the config file called settings.config as opposed to myApplication.exe.confi...

Why does my application look for both MyApp.exe.config and MyApp.config to find the app.config file

I have a check to make sure the app.config file exists and to report an error if it does not: System.Windows.Forms.MessageBox.Show(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); if (!File.Exists(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)) { throw new ConfigurationErrorsException("Unable to find config...

Where are config files for class libraries physically located?

My guess is that this question will fall under the category of "duh", but, nevertheless, I'm confused. When using config files in, for example, a Windows Forms Application, the config file can be found in C:\Program files\CompanyName\ProductName\Application.exe.config. However, with the class library I'm developing I do not see a "Class...

Cannot read app.config, why???

Hello, I'm trying to get data from app.config and I always get zero. The App.config is here: <?xml version="1.0" encoding="utf-8"?> <configuration> <connectionStrings> <add name="ExplorerContext" connectionString="metadata=res://*/ExplorerData.csdl|res://*/ExplorerData.ssdl|res://*/ExplorerData.msl;provider=System.Data.SqlClie...

App.Config Best Practices ?

Normally when you have a application configuration file in your application and your application is expected to read from it. Is it good to check initially at start up if this file exists and raise an error and not to proceed at all ? (Worse case senarios) Or leave it to the unhandled exception manager to handle it and shut down the ap...

Multiple App.Config files

Hello every one I want to separate my app.config file. For example I want to move ServiceModel part to another config file in the same project. How can I do that? Thanks. ...