app-config

How to get a List<string> collection of values from app.config in WPF?

心已入冬 提交于 2019-11-26 12:23:25
问题 The following example fills the ItemsControl with a List of BackupDirectories which I get from code. How can I change this so that I get the same information from the app.config file? XAML: <Window x:Class=\"TestReadMultipler2343.Window1\" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" Title=\"Window1\" Height=\"300\" Width=\"300\"> <Grid Margin=\"10\"> <Grid.RowDefinitions> <RowDefinition Height=\"30\"/>

Encrypt connection string in app.config

戏子无情 提交于 2019-11-26 12:22:52
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. John Mitchell Have a look at This Article it has some very useful examples. You're basically looking for System.Configuration.SectionInformation.ProtectSection to help you out here. Also have a peek at Implementing Protected Configuration benoit You can

Consume a SOAP web service without relying on the app.config

佐手、 提交于 2019-11-26 12:11:16
问题 I\'m building a .NET component that will call an external web service. I used the \"Add Service Reference\" dialog to add the web service to my component, which generates the code needed to consume the service and adds the settings to the app.config file. I\'m testing the component by adding a reference to its DLL from a Console application and calling the appropriate method that creates a new instance of the web service: ... = new MyServiceSoapClient() . However, when I do this, I get the

Visual Studio always selects the wrong xsd for App.config

我们两清 提交于 2019-11-26 12:09:17
问题 first of all, I have a .NET 4.0 application with this configuration: <?xml version=\"1.0\"?> <configuration> <startup> <supportedRuntime version=\"v4.0\" sku=\".NETFramework,Version=v4.0\"/> </startup> </configuration> I had the same problem like the one in this question: app.config "Could not find schema information" after converting to Visual Studio 2010 / .Net 4.0 : The supportedRuntime element was not recognized by the editor, resulting in a hint. I then followed the answer: I was in the

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

别说谁变了你拦得住时间么 提交于 2019-11-26 12:03:16
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? lime 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 variables are under Configuration → Software Configuration: Creating the vars in .ebextensions like in

How to make spring inject value into a static field

怎甘沉沦 提交于 2019-11-26 11:38:59
I know this may looks like a previously asked question but I'm facing a different problem here. I have a utility class that has only static methods. I don't and I won't take an instance from it. public class Utils{ private static Properties dataBaseAttr; public static void methodA(){ } public static void methodB(){ } } Now I need Spring to fill dataBaseAttr with database attributes Properties.Spring config is: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www

How to implement a ConfigurationSection with a ConfigurationElementCollection

假如想象 提交于 2019-11-26 11:00:58
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> <AddService Port="6996" ReportType="File" /> <AddService Port="7001" ReportType="Other" /> </Services> <

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

て烟熏妆下的殇ゞ 提交于 2019-11-26 10:59:47
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="Project1.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0,

Store String Array In appSettings?

喜夏-厌秋 提交于 2019-11-26 09:47:41
问题 I\'d like to store a one dimensional string array as an entry in my appSettings . I can\'t simply separate elements with , or | because the elements themselves could contain those characters. I was thinking of storing the array as JSON then deserializing it using the JavaScriptSerializer . Is there a \"right\" / better way to do this? (My JSON idea feels kinda hacky) 回答1: You could use the AppSettings with a System.Collections.Specialized.StringCollection. var myStringCollection = Properties

Update app.config system.net setting at runtime

心不动则不痛 提交于 2019-11-26 09:34:44
问题 I need to update a setting in the system.net SectionGroup of a .Net exe app.config file at runtime. I don\'t have write access to the original config file at runtime (I am developing a .Net dll add-in which is hosted in an exe provided by the app which I have no control over) so I was hoping to save a copy of the file and replace the config in the exe with the modified version at runtime. I\'ve tried the following but it\'s not working. Any suggestions? Configuration config =