app-config

Use XML includes or config references in app.config to include other config files' settings

ぃ、小莉子 提交于 2019-12-17 03:55:37
问题 I have standard logging, NHibernate, etc. configuration blocks in my app.config and I'd like to extract them into a common XML file that can be included as a reference by all of my applications' app.config files. Is this possible? 回答1: Yes, you can use the configSource attribute of the configuration block. All configuration blocks have this attribute - although it isn't documented. See this article, all the way at the bottom, appendix B. I've also pasted the relevant section below: Appendix B

Custom app.config section with a simple list of “add” elements

99封情书 提交于 2019-12-17 03:28:28
问题 How do I create a custom app.config section that is just a simple list of add elements? I have found a few examples (e.g. How to create custom config section in app.config?) for custom sections that look like this: <RegisterCompanies> <Companies> <Company name="Tata Motors" code="Tata"/> <Company name="Honda Motors" code="Honda"/> </Companies> </RegisterCompanies> But how do I avoid the extra collection element ("Companies") so that it looks the same as the appSettings and connectionStrings

Encrypt connection string in app.config

柔情痞子 提交于 2019-12-17 02:31:02
问题 I am having trouble encrypting a connection string in app.config. I have code that will protect the connectionStrings section of app.config, but the password is still displayed in plain text. I need to encrypt the connection string in so it is not in plain text when deployed. I see similiar questions on SO for web.config, but not app.config. 回答1: Have a look at This Article it has some very useful examples. You're basically looking for System.Configuration.SectionInformation.ProtectSection to

Encrypt connection string in app.config

我怕爱的太早我们不能终老 提交于 2019-12-17 02:30:58
问题 I am having trouble encrypting a connection string in app.config. I have code that will protect the connectionStrings section of app.config, but the password is still displayed in plain text. I need to encrypt the connection string in so it is not in plain text when deployed. I see similiar questions on SO for web.config, but not app.config. 回答1: Have a look at This Article it has some very useful examples. You're basically looking for System.Configuration.SectionInformation.ProtectSection to

How do you pass custom environment variable on Amazon Elastic Beanstalk (AWS EBS)?

╄→尐↘猪︶ㄣ 提交于 2019-12-17 02:26:38
问题 The Amazon Elastic Beanstalk blurb says: Elastic Beanstalk lets you "open the hood" and retain full control ... even pass environment variables through the Elastic Beanstalk console. http://aws.amazon.com/elasticbeanstalk/ How to pass other environment variables besides the one in the Elastic Beanstalk configuration? 回答1: As a heads up to anyone who uses the .ebextensions/*.config way: nowadays you can add, edit and remove environment variables in the Elastic Beanstalk web interface. The

How to implement a ConfigurationSection with a ConfigurationElementCollection

主宰稳场 提交于 2019-12-17 02:06:21
问题 I am trying to implement a custom configuration section in a project and I keep running up against exceptions that I do not understand. I am hoping someone can fill in the blanks here. I have App.config that looks like this: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="ServicesSection" type="RT.Core.Config.ServicesConfigurationSectionHandler, RT.Core"/> </configSections> <ServicesSection type="RT.Core.Config.ServicesSection, RT.Core"> <Services>

Pros and cons of AppSettings vs applicationSettings (.NET app.config / Web.config)

自古美人都是妖i 提交于 2019-12-17 02:01:03
问题 When developing a .NET Windows Forms Application we have the choice between those App.config tags to store our configuration values. Which one is better? <configuration> <!-- Choice 1 --> <appSettings> <add key="RequestTimeoutInMilliseconds" value="10000"/> </appSettings> <!-- Choice 2 --> <configSections> <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c5612342342" > <section name=

How to read web.config section as XML in C#?

萝らか妹 提交于 2019-12-14 04:18:00
问题 This is copied example from: How to read custom config section in app.config in c# I want to read following custom section from app.config: <StartupFolders> <Folders name="a"> <add folderType="Inst" path="c:\foo" /> <add folderType="Prof" path="C:\foo1" /> </Folders> <Folders name="b"> <add folderType="Inst" path="c:\foo" /> <add folderType="Prof" path="C:\foo1" /> </Folders> </StartupFolders> And this is my case too. However, I don't want to create custom class for handling values, defining

Can't transform XML when deploying to VSTS

妖精的绣舞 提交于 2019-12-14 03:18:52
问题 For a VSTS worker role, I'm trying to build configuration transforms so I can change settings based on the environment. I created two files in my solution directory, App.dev.config and App.prod.config, which I have linked to a test project. I then used this tool to apply config transforms and generate the files App.Debug.config and App.Release.config. In my worker role's regular old app.config, I specify that app settings normally come from the App.dev.config file, so it can either remain in

Configuration madness, I have an app.Config but my object looks to web.Config

泄露秘密 提交于 2019-12-13 18:50:16
问题 if you have a class library project that acts as ur DAL and it has an App.Config file with connectionstrings, how can I force it to use that config file? It keep getting values from the web.config in my Web Application project. The DAL project uses LinqToSql. When I instansiate a DataContext object in my Web Application, from the referenced DAL Class Library project, can I make it use it's app.Config connectionstrings? It seems to ignore this file and tries to pick up connectionstrings from