Hello,
This is my first thread on MSDN forum. I have an issue with custom configuration. My custom application configuration looks like this:
If I remove nesting of "Services" ConfigurationElementCollection from "Region" ConfigurationElement then it works!!! What is the problem?
Please help!
Thanks,
Jay
This is my first thread on MSDN forum. I have an issue with custom configuration. My custom application configuration looks like this:
<?xml version="1.0" encoding="utf-8" ?> | |
<configuration> | |
<configSections> | |
<section name="ServerConfiguration.ServerConfig" type="ServerConfiguration.ServerConfig, ServerConfiguration"/> | |
</configSections> | |
<ServerConfiguration.ServerConfig> | |
<Servers> | |
<clearServers/> | |
<Server name="localhost1" port="8080" protocol="net.tcp" hostname="localhost"/> | |
<Server name="localhost2" port="8081" protocol="net.tcp" hostname="localhost"/> | |
</Servers> | |
<Regions> | |
<clearRegions/> | |
<removeRegion name=""/> | |
<Region name="BASE" connectionString="XXXXXXXXXX" servicePath="D:\Services" clientPath="D:\"> | |
<Services> | |
<clearServices/> | |
<Service name="XXXXX"/> | |
</Services> | |
</Region> | |
</Regions> | |
</ServerConfiguration.ServerConfig> | |
</configuration> |
(Please Note: The above configuration schema is changed. Please find the new configuration schema somewhere in following replies. Thanks, - Jay)
The "Services" ConfigurationElementCollection has been nested in "Region" ConfigurationElement. When I try to parse this configuration section, I get following error message:
System.Configuration.ConfigurationErrorsException was unhandled | |
BareMessage="The entry '' has already been added." | |
Filename="" | |
Line=0 | |
Message="The entry '' has already been added." | |
Source="System.Configuration" | |
StackTrace: | |
at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult) at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission) at System.Configuration.BaseConfigurationRecord.GetSection(String configKey) at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName) at System.Configuration.ConfigurationManager.GetSection(String sectionName) at TestApp.Form1.Button1_Click(Object sender, EventArgs e) in C:\Documents and Settings\mmmm\My Documents\Visual Studio 2008\Projects\Server\TestApp\Form1.vb:line 6 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.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.OnMessage(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 System.Windows.Forms.Application.Run(Form mainForm) at TestApp.Form1.Main() in C:\Documents and Settings\mmmm\My Documents\Visual Studio 2008\Projects\Server\TestApp\Form1.Designer.vb:line 2 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() | |
InnerException: | |
If I remove nesting of "Services" ConfigurationElementCollection from "Region" ConfigurationElement then it works!!! What is the problem?
Please help!
Thanks,
Jay