.NET – “Unrecognizable configuration section connectstrings.”

I have been developing a project in VS2005 that uses the local connection of the Access database.

In the past week, I installed .NET framework 3.5 for different projects and VS6.

I went back to my VS2005 application, and then suddenly there were some big problems:

When using any of my OLEDB connections Shown in the class designer:

Unable to cast object of type’System.Configuration.DefaultSection’ to
type’System.Configuration.ConnectionStringsSection’. Hide

at System.Configuration.Configuration.get_ConnectionStrings() at
Microsoft.VisualStudio.Shell.Design.Serialization.ConfigurationHelperService.ReadConnectionStrings(String
configFileName, DocData configDocData, String prefix) at< br> Microsoft.VisualStudio.Editors.SettingsDesigner.AppConfigSerializer.Deserialize(DesignTimeSettings
Settings, String SectionName, DocData AppConfigDocData, MergeValueMode
mergeMode, IUIService UIService) at
Microsoft.VisualStudio.Editors.SettingsGlobalObjects.SettingsFileGlobalObject.LoadSettings (String
fileName) at
Microsoft.VisualStudio.Editors.SettingsGlobalObjects .SettingsFileGlobalObject.BuildType()
at
Microsoft.VisualStudio.Editors.SettingsGlobalObjects.SettingsFileGlobalObject.GetObjectType()
at Microsoft.VisualStudio.Shell.Design.GlobalType.get_ObjectType() at
Microsoft.VisualStudio .Shell.Design.GlobalObject.GetHashCode() at
Microsoft.VisualStudio.Shell.Design.GlobalObjectService.GlobalKey.GetHashCode()
at System.Collections.Generic.ObjectEqualityComparer1.GetHashCode(T
obj) at System.Collections.Generic.Dictionary
2.FindEntry(TKey key) at
Microsoft.VisualStudio.Shell.Design.GlobalObjectService.GetGlobalObjects(Type
baseType) at
Microsoft. VisualStudio.Shell.Design.GlobalObjectService.GetGlobalObjects()
at
Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetTypeFromGlobalObjects(String
name, Boolean throwOnError, Boolean ignoreCase) at
Microsoft. VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String
name, Boolean throwOnError, Boolean ignoreCase) at
Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String
name, Boolean throwOnError) at
System.ComponentModel.Design.Serialization.CodeDomSerializerBase.GetType(ITypeResolutionService
trs, String name, Dictionary2 names) at
System.ComponentModel.Design.Serialization.CodeDomSerializerBase.FillStatementTable(IDesignerSerializationManager
manager, IDictionary table, Dictionary
2 names,
CodeStatementCollection statements, String className) at
System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager
manager, CodeTypeDeclaration declaration) at
System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager br> manager) at
Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager
serializationMana ger) at
Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32
fReload)

When When I run the application, I encounter the following exception at startup:

“Unrecognized configuration section connectionStrings.”

Looking online, these problems seem to be usually related to what is built in VS2005 and deployed on the .net 1.1 framework; but this is all running locally as a Windows Forms application in VS (not on IIS). I tried uninstalling and reinstalling VS2K5 will not help.

Any thoughts?
Thanks,
Matt

This is a very old post, I know , But I recently encountered the same problem, I fixed it by the following way:




In connection characters Before string:



So my app.config looks like:

  


In C# I use the following code to retrieve my connection string:

ConfigurationFileMap fileMap = new ConfigurationFileMap("myApp.config"); //Path to your config file
Configuration configuration = ConfigurationManager.OpenMappedMachineConfiguration(fileMap);
this.connectionString = configuration.ConnectionStrings.Connectio nStrings["XXX"].ConnectionString;

I have been developing a project in VS2005 that uses the local connection of the Access database.

< p>In the past week, I installed .NET framework 3.5 for different projects and VS6.

I went back to my VS2005 application, and suddenly some big problems appeared:

p>

Display in the designer of any class connected using my OLEDB:

Unable to cast object of type’System.Configuration.DefaultSection’ to
type’System.Configuration.ConnectionStringsSection’. Hide

at System.Configuration.Configuration.get_ConnectionStrings() at
Microsoft.VisualStudio.Shell.Design.Serialization.ConfigurationHelperService.ReadConnectionStrings(String
configFileName, DocData configDocData, String prefix) at
Microsoft.VisualStudio.Editors.SettingsDesigner.AppConfigSerializer.Deserialize(DesignTimeSettings
Settings, String SectionName, DocData AppConfigDocData, MergeValueMode
mergeMode, IUIService UIService) at< br> Microsoft.VisualStudio.Editors.SettingsGlobalObjects.SettingsFileGlobalObject.LoadSettings(String
fileName) at
Microsoft.VisualStudio.Editors.Set tingsGlobalObjects.SettingsFileGlobalObject.BuildType()
at
Microsoft.VisualStudio.Editors.SettingsGlobalObjects.SettingsFileGlobalObject.GetObjectType()
at Microsoft.VisualStudio.Shell.Design.GlobalType.get_ObjectType() at
Microsoft. VisualStudio.Shell.Design.GlobalObject.GetHashCode() at
Microsoft.VisualStudio.Shell.Design.GlobalObjectService.GlobalKey.GetHashCode()
at System.Collections.Generic.ObjectEqualityComparer1.GetHashCode(T< br> obj) at System.Collections.Generic.Dictionary2.FindEntry(TKey key) at
Microsoft.VisualStudio.Shell.Design.GlobalObjectService.GetGlobalObjects(Type
baseType) at
Microsoft .VisualStudio.Shell.Design.GlobalObjectService.GetGlobalObjects()
at
Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetTypeFromGlobalObjects(String
name, Boolean throwOnError, Boolean ignoreCase) at
Microsoft .VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetTyp e(String
name, Boolean throwOnError, Boolean ignoreCase) at
Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String
name, Boolean throwOnError) at
System.ComponentModel.Design .Serialization.CodeDomSerializerBase.GetType(ITypeResolutionService
trs, String name, Dictionary2 names) at
System.ComponentModel.Design.Serialization.CodeDomSerializerBase.FillStatementTable(IDesignerSerializationManager
manager, IDictionary table, Dictionary< /code>2 names,
CodeStatementCollection statements, String className) at
System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager
manager, CodeTypeDeclaration declaration) at
System.ComponentModel.Design. Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager
manager) at
Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager
serializationManager) at
Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32
fReload)

When When I run the application, I encounter the following exception at startup:

"Unrecognized configuration section connectionStrings."

Looking online, these problems seem to be usually related to what is built in VS2005 and deployed on the .net 1.1 framework; but this is all running locally as a Windows Forms application in VS (not on IIS). I tried uninstalling and reinstalling VS2K5 will not help.

Any thoughts?
Thanks,
Matt

This is a very old post, I know, but I recently encountered the same problem, I passed The following way fixed it:




Before the connection string:



So my app.config looks like:

  


In C# I use the following Code to retrieve my connection string:

ConfigurationFileMap fileMap = new ConfigurationFileMap("myApp.config"); //Path to your config file
Configuration configuration = ConfigurationManager.OpenMappedMachineConfiguration(fileMap);
this.connectionString = configuration.ConnectionStrings.ConnectionStrings["XXX"].ConnectionString;

Leave a Comment

Your email address will not be published.