app-config

Sections must only appear once per config file! why?

社会主义新天地 提交于 2019-12-03 16:09:59
I'm getting the following exeption: "Sections must only appear once per config file. See the help topic for exceptions. " my configuration file look like this : <configSections> <sectionGroup name="point.System"> <section name="singleInstanceCache" type="xyz.Point.System.Configuration.SingleInstanceCache, Point.System" /> </sectionGroup> <sectionGroup name="point.Services"> <sectionGroup name="xServices" type="xyz.Point.Messaging.PointServiceConfiguration.PointServices, Barcap.FIA.Point.Messaging"> <section name="xService" type="xyz.Point.Messaging.PointServiceConfiguration.PointService,

What happen if I delete App.config in C# application?

自闭症网瘾萝莉.ら 提交于 2019-12-03 15:24:08
问题 I write a small application, that I don't need store anything in config files. So the file App.config in my source is exactly what ever Visual Studio has created. So I want to delete this file from source code (before compiling). But I noticed that it also contains the .NET version information. I wonder if I delete App.config file, then copy my application to other pc, is it have any strange behavior? 回答1: I wonder if I delete App.config file, then copy my application to other pc, is it have

.NET tracing in PowerShell without creating .config file

核能气质少年 提交于 2019-12-03 15:02:52
I know I can enable .NET tracing by adding <system.diagnostics> element to App config ( powershell.exe.config ) in PowerShell installation folder. This is covered in System.Net tracing in Powershell . In fact, I too want to log System.Net tracing source (e.g. FtpWebRequest ) . But is there a way to enable tracing locally? Like in the code itself? Or possibly using some command-line switch? Or can I at least have the App config file in a local folder, not to have to modify the system-wide settings? Peter Wishart Just enabling the default trace sources ( Trace.Information etc.) in code (and

Get filename of current configuration file

荒凉一梦 提交于 2019-12-03 14:28:31
问题 I'd think this would be simple, but I can't find an answer. I'm using remoting and I want to store the RemotingConfiguration in the app.config. When I call RemotingConfiguration.Configure I have to supply the filename where the remoting information resides. So... I need to know the name of the current configuration file. Currently I'm using this: System.Reflection.Assembly.GetExecutingAssembly().Location + ".config" But this only works for windows applications, not for web applications. Isn't

Why is a “bindingRedirect” added to the app.config file after adding the Microsoft.Bcl.Async package?

只谈情不闲聊 提交于 2019-12-03 14:19:58
问题 I was wondering why nuget added the following code to my applications app.config file, after installing the Microsoft.Bcl.Async : <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-2.5.19.0" newVersion="2.5.19.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Threading.Tasks" publicKeyToken=

unable to save settings in app.exe.config

不想你离开。 提交于 2019-12-03 13:54:46
i am facing one problem. i want to save settings in app.config file i wrote separate class and defined section in config file.. but when i run the application. it does not save the given values into config file here is SettingsClass public class MySetting:ConfigurationSection { private static MySetting settings = ConfigurationManager.GetSection("MySetting") as MySetting; public override bool IsReadOnly() { return false; } public static MySetting Settings { get { return settings; } } [ConfigurationProperty("CustomerName")] public String CustomerName { get { return settings["CustomerName"]

.NET own configuration file

陌路散爱 提交于 2019-12-03 13:37:29
Is there any way that I could specify at runtime the configuration file I would like to use (other than App.config)? For example I would like to read a first argument from a command line that will be a path to the application's config and I would like my application to refer to it when I use ConfigurationManager.AppSettings (It's probably impossible but still it's worth asking). I did find this piece of code: System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); config.AppSettings.File = myRuntimeConfigFilePath; config.Save

Access App.Config Settings from Class Library Called through Unit Test Project

ⅰ亾dé卋堺 提交于 2019-12-03 13:25:15
问题 I have the following setup: ASP.net 3.5 Web Site Project C# Class Library with business logic C# Class Library for unit testing The business logic library does all of the db access. It gets connection strings from the web.config file of the web site by accessing System.Configuration.ConfigurationManager.ConnectionStrings. When the library is called by the web site, this works fine, as the library looks for the config of the caller. I want to be able to test my business logic through the unit

How to configure database connection securely

为君一笑 提交于 2019-12-03 13:19:44
问题 Similar but not the same: How to securely store database connection details Securely connecting to database within a application Hi all, I have a C# WinForms application connecting to a database server. The database connection string, including a generic user/pass, is placed in a NHibernate configuration file, which lies in the same directory as the exe file. Now I have this issue: The user that runs the application should not get to know the username/password of the general database user

SmtpClient and app.config system.net configuration

孤者浪人 提交于 2019-12-03 12:11:29
I'm having an issue with a .NET 3.5 library I'm developing to send emails. I put the system.net configuration into app.config : <system.net> <mailSettings> <smtp from="mail@domain.com"> <network host="myserver.com" port="25" defaultCredentials="true" /> </smtp> </mailSettings> </system.net> And I instantiate the SmtpClient without params: SmtpClient client = new SmtpClient(); But the configuration is not read (I'm trying to test the library with NUnit) and I get a System.InvalidOperationException , because the configuration is not read and thus the host is null. Shouldn't the configuration be