An Error Occurred Executing The Configuration Section Handler For Appsettings
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you an error occurred creating the configuration section handler for could not load type might have Meta Discuss the workings and policies of this site
An Error Occurred Creating The Configuration Section Handler For Could Not Load File Or Assembly
About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or an error occurred creating the configuration section handler sql server 2008 posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of configurationsection properties cannot be edited when locked. appsettings 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up An error occurred creating the configuration section handler up vote 3 down vote favorite 1 I have a dot.NET 4.0 web application with a custom section defined: PublicKeyToken=b77a5c561934e089" requirePermission="true" restartOnExternalChanges="true" allowLocation="true"/> .... at the end of the web.config file I have the respective section: ....
here for a quick overview of the site Help Center Detailed answers to any questions you might failed to encrypt the section connectionstrings object already exists have Meta Discuss the workings and policies of this site About configurationsection properties cannot be edited when locked web config Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting
An Error Occurred Executing The Configuration Section Handler For Connectionstrings
ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 http://stackoverflow.com/questions/16285169/an-error-occurred-creating-the-configuration-section-handler million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up C# ConfigurationManager.GetSection could not load file or assembly up vote 11 down vote favorite 1 I am stuck! this seems really daft but I can not see where I am going wrong. I am creating a 2.0 C# http://stackoverflow.com/questions/452004/c-sharp-configurationmanager-getsection-could-not-load-file-or-assembly ASP.NET website. I am trying to use a custom section in the web.config file with: DatabaseFactorySectionHandler sectionHandler = ConfigurationManager.GetSection("DatabaseFactoryConfiguration") as DatabaseFactorySectionHandler; I have a separate DLL for the Objects which are in Bailey.DataLayer namespace. But when I run the test.aspx page I get the following error: System.Configuration.ConfigurationErrorsException was unhandled by user code Message="An error occurred creating the configuration section handler for DatabaseFactoryConfiguration: Could not load file or assembly 'Bailey.DataLayer' or one of its dependencies. The system cannot find the file specified. (C:\\Documents and Settings\\Administrator.PIP\\My Documents\\Visual Studio 2005\\WebSites\\bailey\\web.config line 13)" Source="System.Configuration" The class that I am trying to get is as follows: namespace Bailey.DataLayer { public sealed class DatabaseFactorySectionHandler : ConfigurationSection { [ConfigurationProperty("Name")] public string Name { get { return (string)base["Name"]; } } [ConfigurationProperty("ConnectionStringName")] public string ConnectionStringName { get { return (string)base["ConnectionStringName"]; } } public string ConnectionString { get { try { return ConfigurationManager.ConnectionStrings[ConnectionStringName].ConnectionString; } catch (Exception excep) { throw new Exception("Connection string " + ConnectionStringName + " was not found in web.config. "
Framework > Common Language Runtime Internals and Architecture Question 0 Sign https://social.msdn.microsoft.com/Forums/vstudio/en-US/7bebd705-75e4-4ea2-90d2-2ac8f6819dfa/problem-with-configurationmanageropenexeconfiguration?forum=clr in to vote Well, I don't have any problem if Iopen the configuration using ConfigurationUserLevel.None, but if I use any of the other two choices (ConfigurationUserLevel.PerUserRoaming ConfigurationUserLevel.PerUserRoamingAndLocal), it doesn't allow me to save .I've noticed that using PerUserRoamingAndLocal or PerUserRoaming, Configuration.HasFile sometimes is set an error to false and FilePath is something like: C:\Documents and Settings\xxxx\Application Data\wwSmsClient\xxxx.vshost.exe_Url_epzwfwzp5m32ievsfjken31n2fchrmn\1.0.0.4\user.config I read about this problem, but no solution..this is my code: Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoaming);UserSettings settings;if ((settings = (UserSettings)configuration.Sections[GENERAL_USER_SETTINGS]) == null){ settings = new UserSettings();configuration.Sections.Add(GENERAL_USER_SETTINGS, settings); configuration.Save();}
Now ifI set some values and an error occurred then I try to save, I get the error: "An error occurred executing the configuration section handler for UserSettings."The inner exception says: "ConfigurationSection properties cannot be edited when locked." can you help me? thanks! Sunday, January 22, 2006 10:48 PM Reply | Quote Answers 1 Sign in to vote You need to set the SectionInformation.AllowExeDefinition value for the section: Â Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoaming);UserSettings settings;if ((settings = (UserSettings)configuration.Sections[GENERAL_USER_SETTINGS]) == null){Â Â Â Â Â settings = new UserSettings();Â Â Â Â Â settings.SectionInformation.AllowExeDefinition =Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ConfigurationAllowExeDefinition.MachineToLocalUser;Â Â Â Â Â Â configuration.Sections.Add(GENERAL_USER_SETTINGS, settings);Â Â Â Â Â configuration.Save();} The default value is ConfigurationAllowExeDefinition.MachineToApplication which allows only to place the section on machine.config and app.exe.config. Wednesday, February 08, 2006 8:18 PM Reply | Quote All replies 1 Sign in to vote You need to set the SectionInformation.AllowExeDefinition value for the section: Â Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoaming);UserSettings settings;if ((settings = (UserSettings)configuration.Sections[GENERAL_USER_SETTINGS]) == null){Â