app-config

Common.Logging config exception

萝らか妹 提交于 2019-12-10 12:46:00
问题 I'm getting the following exception when I try to call var log = LogManager.GetLogger(this.GetType()); A first chance exception of type 'Common.Logging.ConfigurationException' occurred in Common.Logging.dll An unhanded exception of type 'Common.Logging.ConfigurationException' occurred in Common.Logging.dll Additional information: Failed obtaining configuration for Common.Logging from configuration section 'common/logging'. This is a .NET 4 application with references to log4net.dll Common

Application settings error after changing target framework of project

老子叫甜甜 提交于 2019-12-10 12:40:08
问题 In my application I am using user settings as explained here. Then I realized that in VS 2010 I was using .NET 4.0 while only .NET 2.0 was sufficient. When I changed the framework and build the project, in my code whenever I access setting now, I get the following error: An error occurred creating the configuration section handler for userSettings/Vegi_Manager.Properties.Settings: Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or

My App.Config file isn't saving anything I modify

喜夏-厌秋 提交于 2019-12-10 11:54:46
问题 Here's my code: public void VerifyIfFirstTimeRun() { if (System.Configuration.ConfigurationSettings.AppSettings["FirstTimeRunning"] == "true") { //Do bla bla bla //Then do bla bla bla System.Configuration.ConfigurationSettings.AppSettings["FirstTimeRunning"] = "false"; } } Problem is, I'm testing this with the F5 key, it boots up and sure enough using a breakpoint shows that it is indeed going inside the If Condition, but when I "Stop" the application and press F5 again it goes inside the If

Reading settings from App.Config

孤者浪人 提交于 2019-12-10 11:36:22
问题 Config file. How should I read values of username and password in C# using System.Configuration.ConfigurationManager class? I have tried several stuff but to no avail. The app.config is given below. <configuration> <configSections> <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > <section name="Fulfillment.Properties.Settings" type="System.Configuration

Where are config files for class libraries physically located?

谁说胖子不能爱 提交于 2019-12-10 10:55:51
问题 My guess is that this question will fall under the category of "duh", but, nevertheless, I'm confused. When using config files in, for example, a Windows Forms Application, the config file can be found in C:\Program files\CompanyName\ProductName\Application.exe.config . However, with the class library I'm developing I do not see a " ClassLibrary.dll.config " file in the install folder after installing it (in tandem with another project) from Visual Studio. Even though I do not see the file

How to configure NHibernate logging with log4net in code, not in xml file?

允我心安 提交于 2019-12-10 10:54:35
问题 Relying on this doc http://nhibernate.info/doc/howto/various/configure-log4net-for-use-with-nhibernate.html it is quite easy to configure NHibernate logging through log4net by using XML config files. But i need to do the same in C# code. 回答1: This answer is based on How to configure log4net programmatically from scratch (no config). However, since that answer only provides a solution for the root logger, I expanded that a little. /// <summary> /// Test for Log4Net /// </summary> public static

Which NuGet package creates the web.config in your Views folder?

杀马特。学长 韩版系。学妹 提交于 2019-12-10 10:49:42
问题 My project is missing the web.config file from the Views folder. Here are the steps I took to make the project. Created an empty MVC project and installed the packages listed below. Created a controller and view. The view was created by right-clicking the action name and selecting 'Add View...' from the menu. Attempt to run the project, but got the error CS0103: The name 'ViewBag' does not exist in the current context I am getting this error because web.config is missing from my Views folder.

Make the connectionstring's AttachDbFilename relative in config file

谁说我不能喝 提交于 2019-12-10 10:48:12
问题 I am working on a project using an mdf file generated locally using Entity Framework Code First. The path to this mdf is set in several config files in my solution using <connectionStrings> sections like so : <add name="DataContext" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename="E:\path\to\project\app_data\local.mdf";Integrated Security=True" providerName="System.Data.SqlClient" /> I use git versionning on this project both from work and at home, thus at work the mdf filepath

IIS Config file in virtual directory

丶灬走出姿态 提交于 2019-12-10 10:47:01
问题 I have multiple websites that all have the same code, but different app settings. I want to place my app settings in a separate configuration file that is located in a virtual directory. This will allow me to have a single copy of all of the code shared across all of the sites with a different virtual directory for each site. Unfortunately, when I try to configure this, IIS doesn't process the config file when it is in a virtual directory. If you have a solution to this, I would appreciate

How to programmatically change an endpoint's identity configuration?

与世无争的帅哥 提交于 2019-12-10 10:41:08
问题 I am trying to create a tool to modify my service's app.config file programmatically. The code is something like this, string _configurationPath = @"D:\MyService.exe.config"; ExeConfigurationFileMap executionFileMap = new ExeConfigurationFileMap(); executionFileMap.ExeConfigFilename = _configurationPath; System.Configuration.Configuration config = ConfigurationManager.OpenMappedExeConfiguration(executionFileMap, ConfigurationUserLevel.None); ServiceModelSectionGroup serviceModeGroup =