app-config

Writing/Reading User-Defined settings in app.config file

谁都会走 提交于 2019-12-12 04:46:28
问题 I am trying to read and write into app.config file of user-settings. I found a snippet of a code for working with confige file. I finally got it compiling and running, but it absolutely seems to be doing nothing to the App.config file. Here is the code: Method MainForm1.Button1.Click(sender: System.Object; e: System.EventArgs); var config : System.Configuration.Configuration; begin config:=ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); config.AppSettings.Settings.Add(

Customized IEnumerable in ConfigurationSection II

风流意气都作罢 提交于 2019-12-12 04:37:01
问题 Original question and code : Customized IEnumerable in ConfigurationSection Advancing in solution to this and with @Daniel Hilgarth answer I have changed (app.config) this: <section name="Disk" type="ConsoleApplication1_ConfigurationEnumerable.PathsConfigSection"/> to this one: <section name="Disk" type="ConsoleApplication1_ConfigurationEnumerable.PathsConfigSection, ConsoleApplication1_ConfigurationEnumerable"/> Now, I have this another exception: System.Configuration

Getting a ConnectionString from app.config

时光总嘲笑我的痴心妄想 提交于 2019-12-12 03:53:31
问题 I have a Web project which calls a library project (DataAccess) to retrieve some data from the database. I added an App.config file (Add -> New Item -> Application Configuration File) to the DataAccess project and added a connectionString section like this: <configuration> <connectionStrings> <add name="local" connectionString="Data Source=.\sql2008;Initial Catalog=myDB;Integrated Security=True" providerName="System.Data.SqlClient" /> </connectionStrings> </configuration> In the DataAccess

Encrypt App.Config Custom Element using cmd

隐身守侯 提交于 2019-12-12 03:46:58
问题 I am able to configure the Connection String Encryption using the aspnet_regiis.exe command. Now I have created the Configuration Section on which it is added Custom Configuration Element Collection and this will store the value of Connection Information. namespace ExpressSnapSortCreation { /// <summary> /// This Class hold the the Collection of Cofigration key /// </summary> internal class ServerReplicationsCollection : ConfigurationElementCollection { /// <summary> /// This Will return the

Is it possible to use different config file on different Winform Projects at runtime?

两盒软妹~` 提交于 2019-12-12 03:39:28
问题 Basically I have two projects. Lets name it Project A and Project B. Both projects are WinForm apps. There are times that I will call forms in Project B from Project A. Since both projects has different implementation of connection strings, business layer, services, and models, these are all set under app.config per project, which have different content, of course. In other words, Project A has its own app.config. Project B has its own app.config. Now I want to use or rather switch app.config

Configuration system failed to initialize after adding a new external config file containing a new section

旧城冷巷雨未停 提交于 2019-12-12 03:23:09
问题 My application runs with the AppSettings.config and ConnectionStrings.config external to the App.config. I want to add another config file GlobalSettings.config in which I will pull in information from that I don't want contained in the AppSettings.config. In preparation to asking this question, I read the following SO questions, implemented suggested solutions, and have not found a solution: Multiple AppSettings files, is it possible? Configuration system failed to initialize error while

how to read encrypted app.config appSettings in win console application?

微笑、不失礼 提交于 2019-12-12 03:20:05
问题 EDIT: This question made no sense. I mixed .vshost.config with exe.config. What to do with this? Program.cs main: databaseName = System.Configuration.ConfigurationManager.AppSettings["DatabaseName"]; databaseUser = System.Configuration.ConfigurationManager.AppSettings["DatabaseUser"]; databasePwd = System.Configuration.ConfigurationManager.AppSettings["DatabasePassword"]; port = System.Configuration.ConfigurationManager.AppSettings["Port"]; logDirectory = System.Configuration

app.config for WinForm .NET 4 to Private Deploy SQL Server CE SP2

蹲街弑〆低调 提交于 2019-12-12 02:26:30
问题 My Visual Studio 2010 (C#) application is working, and I've been trying to deploy it using a Setup Project all this week with no success. I started by following Steve Lasker's Web Blog on Privately Deploying SQL Server Compact with the ADO.NET Entity Provider. It had me modify the project's app.config file to include the following: <system.data> <DbProviderFactories> <remove invariant="System.Data.SqlServerCe.3.5"></remove> <add name="Microsoft SQL Server Compact Data Provider" invariant=

Can't resolve types from unity config file

守給你的承諾、 提交于 2019-12-12 02:15:02
问题 Trying to set up Unity via XML configurations I'm getting this exception The type name or alias ServiceHost could not be resolved. Please check your configuration file and verify this type name. Trying to comment that out I get the same exception for the next and then the next after that so the problem must lie somewhere in my setup. <unity> <typeAliases> <!-- Lifetime manager types --> <typeAlias alias="singleton" type="Microsoft.Practices.Unity.ContainerControlledLifetimeManager, Microsoft

Does a web.config substitute app.config?

旧巷老猫 提交于 2019-12-12 01:26:29
问题 I wrote a dll project in c#. I added a service reference. A app.config was automatically generated. In the same solution I have an asp.net project. If I copy paste the relevant configuration from the app.config to the web.config and change the client url - will it override the service url in the app.config? The funny thing is that everything works OK even without copying this section to the web.config. How come? TIA 回答1: Yes. The config schema is the same for web and app.config. There are