app-config

Reading configuration section Failed

孤者浪人 提交于 2019-12-06 11:32:18
问题 I'm having a problem with some application. When I execute it in local disk all is right, but when I try to execute the same application from a shared resource (Z:\resource\TheApplication.exe) I got the following error: Error occurred creating the configuration section handler for DOMAIN/DomainUserInfo: Request failed The error occurs when trying to read a custom section in the configuration file : public static class AppConfigFile { public static IDomainUserInfo DomainUserInfo { get { if (

IIS Config file in virtual directory

孤人 提交于 2019-12-06 10:20:43
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 your help. Maybe using the machine.config file on your web server would be a suitable alternative?

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

浪子不回头ぞ 提交于 2019-12-06 10:08:12
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. Florian Lim 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 void TestLog4Net() { // Configures log4net ConfigureLog4net(); ILog log = LogManager.GetLogger

App.Config Ignored After Pre-Build Event

六眼飞鱼酱① 提交于 2019-12-06 09:46:18
I have a solution with several projects and several developers, each with their own environment (of course). To manage connection strings between each environment, I have created several app.config files for each environment: app.config.dev, app.config.qa, etc. The pre-build event simply copies the app.config.$(ConfigurationName) to app.config. This pre-build event is done for each project in the solution, and the connection string is included in each (including the test project). When I use the pre-build events to manage the app.config files, the connection string cannot be found. I can get

Storing data into appconfig from textbox

末鹿安然 提交于 2019-12-06 06:00:45
I have textbox in which I select path for .txt , in it are saved and encoded data for SqlConnection : Stream myStream = null; OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.InitialDirectory = "c:\\"; openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; openFileDialog1.FilterIndex = 2; openFileDialog1.RestoreDirectory = true; if (openFileDialog1.ShowDialog() == DialogResult.OK) { try { if ((myStream = openFileDialog1.OpenFile()) != null) { using (myStream) { // Insert code to read the stream here. } } } catch (Exception ex) { MessageBox.Show("Error:

Log4net for windows service

安稳与你 提交于 2019-12-06 05:47:16
This is first time I am using Log4net . It doesn't show any errors, but is not writing to file. I added following in my AppConfig file: <configuration> <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" requirePermission="false"/> </configSections> <log4net> <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender"> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%5level [%thread] (%file:%line) - %message%newline"/> </layout> </appender> <appender name="LogFileAppender" type="log4net.Appender

SQLite Entity Framework without App.config

℡╲_俬逩灬. 提交于 2019-12-06 05:24:58
问题 It is necessary to use the SQLite Entity Framework Database-first approach for the 3d-party application plugin. I searched all the Internet, including Add a DbProviderFactory without an App.Config, Problems using Entity Framework 6 and SQLite and many other. I have tried to use them all in different ways and combinations, but nothing helps: "An unhandled exception of type 'System.Data.Entity.Core.MetadataException' occurred in mscorlib.dll. Additional information: Schema specified is not

Clickonce application not seeting AppSettings

时光毁灭记忆、已成空白 提交于 2019-12-06 05:15:19
I have a Full trust, online only, click-once application that relies on settings in the App.config --> appSettings collection. Once published, the first time the application is executed, the settings are read and everything works fine. If I close the application and run it again, the items that are in appSettings are no longer there and appSettings.Count is equal to 0. I have set the app.config as "Content" and to "Copy Always". Any Idea what could be causing the items in appSettings to disappear? or a way to get around this? Also, please note that the settings are only being read, and being

How to use encrypted connection string on app.config with Dataset.xsd generated by Wizard on Windows Form

丶灬走出姿态 提交于 2019-12-06 04:34:28
I'm developing an MDI application with Visual Studio 2013 (.NET 4.5) and Oracle Developer Tools latest release. I need to create a main form that then will be the container for many different forms, each of which will be a different application. The application have to connect to different Oracle databases and now I'm trying to set the main form to keep all the connection strings encrypted and possibly on a separate file. For now the connection string is only one. To encrypt the connection string I've used the aspnet_regiis method described on those articles: Web Config Encryption/Decryption

How to catch exception when loading .NET WinForm app user.config file?

强颜欢笑 提交于 2019-12-06 03:04:41
问题 Sometimes in .NET (2.0) WinForm desktop apps which use the default configuration system, the user.config file will become corrupted and can't be loaded anymore (when the configuration system tries to load it, it'll throw a System.Xml.XmlException ). Putting aside the question of "why did the file get corrupted in the first place" (maybe it was cosmic rays, or HDD problems, or something else you can't control), the question then becomes "how can one catch this exception and do something