Configuration Is Read Only Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the
The Configuration Is Read Only C#
workings and policies of this site About Us Learn more about Stack the configuration is read only appsettings Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions
The Virtual Machine Configuration Is Read Only
Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join jenkins read only configuration them; it only takes a minute: Sign up Getting “Object is read only” error when setting ClientCredentials in WCF up vote 15 down vote favorite 2 I have a proxy object generated by Visual Studio (client side) named ServerClient. I am attempting to set ClientCredentials.UserName.UserName/Password before opening up a new connection using this code: InstanceContext context = new InstanceContext(this); ansys read only configuration m_client = new ServerClient(context); m_client.ClientCredentials.UserName.UserName = "Sample"; As soon as the code hits the UserName line it fails with an "Object is read-only" error. I know this can happen if the connection is already open or faulted, but at this point I haven't called context.Open() yet. I have configured the Bindings (which uses netTcpBinding) to use Message as it's security mode, and MessageClientCredentialType is set to UserName. Any ideas? visual-studio wcf share|improve this question edited Feb 9 '10 at 23:22 bignose 9,91463561 asked Oct 13 '08 at 20:57 Paul Mrozowski 4,22561733 add a comment| 9 Answers 9 active oldest votes up vote 11 down vote I noticed that after creating an instance of the proxy class for the service, I can set the Username and Password once without errors and do a successful call to my webservice. When I then try to set the Username and Password again on the existing instance (unnecessary of course) I get the 'Object is Read-Only' error you mentioned. Setting the values once per instance lifetime worked for me. share|impro
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company
Vmware The Virtual Machine Configuration Is Read Only
Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs system.configuration.configurationerrorsexception : the configuration is read only. Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers,
C# User Settings
just like you, helping each other. Join them; it only takes a minute: Sign up Applicaion Settings saving problem up vote 5 down vote favorite I have two assemblies in my application. MyApplication.BO and MyApplication.GUI. I have http://stackoverflow.com/questions/199014/getting-object-is-read-only-error-when-setting-clientcredentials-in-wcf configured property-settings for my BO assembly. Now when I am trying to compile the following code: public class MyApplicationInfo { private string _nameOfTheUser; public string FullNameOfTheUser { get { return _nameOfTheUser; } set { _nameOfTheUser = value; } } public void Save() { try { MyApplication.BO.Properties.Settings.Default.FullNameOfTheUser = this.FullNameOfTheUser; MyApplication.BO.Properties.Settings.Default.Save(); } catch (Exception ex) { throw ex; } } } VS2005 is giving me the following compilation error: Error 1 Property or indexer 'MyApplication.BO.Properties.Settings.FullNameOfTheUser' cannot http://stackoverflow.com/questions/1809312/applicaion-settings-saving-problem be assigned to -- it is read only F:\CS\MyApplication\MyApplication.BO\MyApplicationInfo.cs 57 17 MyApplication.BO What is wrong with my approach? c# application-settings share|improve this question asked Nov 27 '09 at 15:16 anonymous 4,43236126263 add a comment| 2 Answers 2 active oldest votes up vote 13 down vote accepted In the Settings designer, make sure that the Scope property for FullNameOfTheUser is set to "User". If you create an Application-scoped setting, it is generated as a read-only property. Take a look at this article for more information. share|improve this answer answered Nov 27 '09 at 15:31 Rory 2,1441109 add a comment| up vote 1 down vote The setting needs to have user, not application scope. share|improve this answer answered Nov 27 '09 at 15:28 Fiona - myaccessible.website 7,6221060105 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged c# application-settings or ask your own question. asked 6 years ago viewed 7800 times active 6 years ago Blog Stack Overflow Podcast #89 - The Decline of Stack Overf
read only 15 August http://stevemichelotti.com/configurationerrorsexception-the-configuration-is-read-only/ 2007 The .NET 2.0 Configuration API https://bytes.com/topic/c-sharp/answers/560332-configuration-read-only is a huge step up from the previous versions of the framework rendering many other previous configuration framework (Enterprise Library Configuration block, etc.) virtually obsolete. read only However, one thing that can trip people up is when they try to assign to a configuration property at run-time you can get a ConfigurationErrorsException - The configuration is read configuration is read only even when a setter is defined on their property: [ConfigurationProperty(item1Property, DefaultValue = 1, IsRequired=true)] [IntegerValidator(MinValue=1, MaxValue=100)] public int ConfigItem1 { get { return Convert.ToInt32(this[item1Property]); } set { this[item1Property] = value; } } The ConfigurationSection inherits from ConfigurationElement which defines a virtual method for IsReadOnly(). If you want to avoid this exception and actually assign your values at run-time simply override this method in your ConfigurationSection or ConfigurationElement class like this: public override bool IsReadOnly() { return false; } Written by Steve Michelotti Please enable JavaScript to view the comments powered by Disqus.
and get tips & solutions from a community of 418,461 IT Pros & Developers. It's quick & easy. Configuration is read only P: n/a Rua Hello I need to include some name value properties in runtime. I tried ConfigurationManager.AppSettings.Add(strLSystem, strClient); but it tells me that configuration is read only. Can anyone tell me how to do this? It does not have to be written in the app file, but I need to write permanent configuration information, basically for personalization TIA Nov 7 '06 #1 Post Reply Share this Question 2 Replies P: n/a Michael Nemtsev Hello Rua, See this one http://msdn2.microsoft.com/en-us/lib...gssection.aspx RHello R> RI need to include some name value properties in runtime. I tried R> RConfigurationManager.AppSettings.Add(strLSystem, strClient); R> Rbut it tells me that configuration is read only. Can anyone tell me Rhow to do this? It does not have to be written in the app file, but I Rneed to write permanent configuration information, basically for Rpersonalization R> RTIA R> --- WBR, Michael Nemtsev :: blog: http://spaces.live.com/laflour "At times one remains faithful to a cause only because its opponents do not cease to be insipid." (c) Friedrich Nietzsche Nov 7 '06 #2 P: n/a Shailen Sukul Step 1. Add a reference to System.Configuration Step 2. Add a using System.Configuration at the top of your class ConfigurationManager.AppSettings.Add(strLSystem, strClient); should work now. "Rua" wrote: Hello I need to include some name value properties in runtime. I tried ConfigurationManager.AppSettings.Add(strLSystem, strClient); but it tells me that configuration is read only. Can anyone tell me how to do this? It does not have to be written in the app file, but I need to write permanent configuration information, basically for personalization TIA Nov 8 '06 #3 This discussion thread is closed Start new discussion Replies have been disabled for this discussion. Similar topics Custom Configuration Sections in Location Tag web.config custom Configuration Section Configuration File Custom Configuration at Application Directory Level What's best way to include configuration settings with assembly? Best way to Read/write user/machine setting configuration files Problem wiyh Applic