c# – 访问settings.settings时“配置系统无法初始化”
发布时间:2020-12-15 18:15:39 所属栏目:百科 来源:网络整理
导读:自从删除原始settings.settings文件以来,我遇到了无穷无尽的问题,让设置正常运行.我收到get或set方法的“配置系统初始化失败”错误.有任何想法吗?谢谢. public static Settings Default { get { return defaultInstance; } } [global::System.Configuration
自从删除原始settings.settings文件以来,我遇到了无穷无尽的问题,让设置正常运行.我收到get或set方法的“配置系统初始化失败”错误.有任何想法吗?谢谢.
public static Settings Default { get { return defaultInstance; } } [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("Keywords.log")] public string KeywordsLog { get { return ((string)(this["KeywordsLog"])); } set { this["KeywordsLog"] = value; } } 问题位于Settings.Designer.cs中 阿德里安班克斯,我怕我不知道如何进一步调试?它已经打破了错误.给出的框的标题是“ConfigurationErrorsException”,如果这有任何帮助. 我道歉,我没有意识到你可以在VS中看到更多细节. System.Configuration.ConfigurationErrorsException was unhandled Message="Configuration system failed to initialize" Source="System.Configuration" BareMessage="Configuration system failed to initialize" Line=0 StackTrace: at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey) at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName) at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.RefreshConfig(String sectionName) at System.Configuration.ConfigurationManager.RefreshSection(String sectionName) at System.Configuration.ClientSettingsStore.ReadSettings(String sectionName,Boolean isUserScoped) at System.Configuration.LocalFileSettingsProvider.GetPropertyValues(SettingsContext context,SettingsPropertyCollection properties) at System.Configuration.SettingsBase.GetPropertiesFromProvider(SettingsProvider provider) at System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName) at System.Configuration.SettingsBase.get_Item(String propertyName) at System.Configuration.ApplicationSettingsBase.GetPropertyValue(String propertyName) at System.Configuration.ApplicationSettingsBase.get_Item(String propertyName) at READOO.Properties.Settings.get_KeywordsLog() in C:UsersUSERDocumentsVisual Studio 2008ProjectsREADOOREADOOPropertiesSettings.Designer.cs:line 31 at READOO.SettingsWindow..ctor() in C:UsersUSERDocumentsVisual Studio 2008ProjectsREADOOREADOOSettingsWindow.cs:line 19 at READOO.WelcomeWindow.Settings_Click(Object sender,EventArgs e) in C:UsersuserDocumentsVisual Studio 2008ProjectsREADOOREADOOWelcomeWindow.cs:line 23 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m,MouseButtons button,Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,Int32 msg,IntPtr wparam,IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID,Int32 reason,Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason,ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason,ApplicationContext context) at READOO.Program.Main() in C:UsersUSERDocumentsVisual Studio 2008ProjectsREADOOREADOOProgram.cs:line 18 at System.AppDomain._nExecuteAssembly(Assembly assembly,String[] args) at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext,String[] activationCustomData) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone() at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: System.Configuration.ConfigurationErrorsException Message="Section or group name 'READOO.Properties.Settings' is already defined. This can not be defined multiple times. (C:UsersUSERDocumentsVisual Studio 2008ProjectsREADOOREADOObinDebugREADOO.exe.config line 6)" Source="System.Configuration" BareMessage="Section or group name 'READOO.Properties.Settings' is already defined. This can not be defined multiple times." Filename="C:UsersUSERDocumentsVisual Studio 2008ProjectsREADOOREADOObinDebugREADOO.exe.config" Line=6 StackTrace: at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal) at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors() at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey) InnerException: @ joan – >寒意. 解决方法
这将是你的线索:
你可能有2< section name =“READOO.Properties.Settings”> < configSections>中的元素该配置文件中的定义. 重复条目很可能在所述配置文件中的第6行. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |