app-config

Creating Custom Binding programmatically

假装没事ソ 提交于 2020-01-15 10:06:00
问题 We need compression in our WCF Web Service and have already found a good solution: http://www.codeproject.com/Articles/53718/Extending-WCF-Part-II There's only one problem. Configuration files are no option. How those Custom Bindings can be created in code? <customBinding> <binding name="ZipBinding" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"> <customMessageEncoding innerMessageEncoding="mtomMessageEncoding" messageEncoderType=

reading content of an config file into the dll associated with it

a 夏天 提交于 2020-01-15 03:50:37
问题 I have saved strings in a dll application's setting. I want to retireve them. Here is the configuration file for my dll: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxxxxxxx" > <section name="Search.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture

Configuration of .NET assembly binding of any newer assembly version in app.config <assemblyBinding>/<codeBase>

这一生的挚爱 提交于 2020-01-14 19:14:36
问题 In a C# project, I use an external assembly and add it in the References of the project. Let's say the assembly is called " ABC " , located at compile-time c:\complie-time\abc.dll of version 1.0.0.0 . The "Copy Local" is set to false. Because it is not copied local, the assembly location has to be specified in app.config. <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="ABC" culture="neutral" publicKeyToken="xyz"/> <codeBase

How do you stop a TextWriterTraceListener from appending using app.config?

三世轮回 提交于 2020-01-14 10:09:04
问题 I'm using System.Diagnostics.TraceSource for logging and one of my listeners is a TextWriterTraceListener. In the tracing primer here it sets this up as follows: <listeners> <add initializeData="output.txt" type="System.Diagnostics.TextWriterTraceListener" name="myLocalListener" /> </listeners> The problem is that this will always append to output.txt. How do you alter this to an overwrite in the config file? Programmatically the listener I want is a: new TextWriterTraceListener(new

app.config are not saving the values

流过昼夜 提交于 2020-01-12 14:49:13
问题 My App.Config is something like: <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="foo" value=""/> </appSettings> </configuration> I try to save the foo value using the following method: private void SaveValue(string value) { var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); config.AppSettings.Settings.Add("foo", value); config.Save(ConfigurationSaveMode.Modified); } but this not change the value of it. and I don't get a

Location of app.config file used by referenced library for My.Settings?

≡放荡痞女 提交于 2020-01-11 11:04:05
问题 If I have a class library with an app.config file (I know it's not ideal, just bear with me for a moment) which has settings values created by using the projects Settings tab and accessed like this: Public Shared Function GetMySetting(key As String) As String Dim value As String = My.Settings.Item(key) If value = String.Empty Then value = "Setting " & key & " not found." Return value End Function I then retrieve the settings from an application like this: sb.AppendLine("GetMySetting: " &

Change Microsoft Config File Encryption Method From TripleDES

自古美人都是妖i 提交于 2020-01-10 20:06:30
问题 When encrypting ("protecting") Microsoft config sections, you get something that looks like the XML below. It follows (at least partially) the W3 spec for XML Encryption. However, in the XML below you'll see that the EncryptionMethod under the EncryptedData section is "tripledes-cbc". We would like to be able to change that to a more-secure alternative, specifically AES, which is specified in the aforementioned W3 spec as well. In many calls with Microsoft's support engineers, they are

How do you instruct NUnit to load an assembly's dll.config file from a specific directory?

做~自己de王妃 提交于 2020-01-10 18:01:07
问题 If an assembly contains an app.config file, ConfigurationManager will load it as long as it is in the same directory as the NUnit project that is executing through NUnit-Gui. To illustrate consider the following folder structure. + TestFolder testProject.nunit + AssemblyAFolder assemblyA.dll assemblyA.dll.config + AssemblyBFolder assemblyB.dll assemblyB.dll.config Both AssemblyA and AssemblyB exercise code that calls into ConfigurationManager . If I run these test assemblies independently in

Custom config section containing collection

若如初见. 提交于 2020-01-10 17:56:28
问题 I'm having trouble getting a custom config section to work. It's some code I got from the web in an effort to try to understand this area a little better and enable me to get to where I want to ultimatly be, my own custom config section. The error I get when I run the code in a console app is ' Unrecognized attribute 'extension'. Note that attribute names are case-sensitive. ' The code in the main app to get things going is var conf = ConfigurationManager.GetSection("uploadDirector"); and

Setup App.Config As Custom Action in Setup Project

守給你的承諾、 提交于 2020-01-10 17:45:09
问题 I have a custom application with a simple app.config specifying SQL Server name and Database, I want to prompt the user on application install for application configuration items and then update the app.config file. I admit I'm totally new to setup projects and am looking for some guidance. Thank You Mark Koops 回答1: I had problems with the code Gulzar linked to on a 64 bit machine. I found the link below to be a simple solution to getting values from the config ui into the app.config. http:/