# Error after executing Enable-Migration(The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception.)

**URL:** <https://forum.codewithmosh.com/t/error-after-executing-enable-migration-the-type-initializer-for-system-data-entity-internal-appconfig-threw-an-exception/20819>\
**Category:** Entity Framework\
**Created:** [June 15, 2023, 4:18am UTC](https://forum.codewithmosh.com/t/error-after-executing-enable-migration-the-type-initializer-for-system-data-entity-internal-appconfig-threw-an-exception/20819 "2023-06-15T04:18:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Parth](https://avatars.discourse-cdn.com/v4/letter/p/e56c9b/32.png) [@Parth](https://forum.codewithmosh.com/u/Parth)\
**Post date:** [June 15, 2023, 4:18am UTC](https://forum.codewithmosh.com/t/error-after-executing-enable-migration-the-type-initializer-for-system-data-entity-internal-appconfig-threw-an-exception/20819/1 "2023-06-15T04:18:29Z")

</div>

PM\> Enable-Migrations  
A version of Entity Framework older than 6.3 is also installed. The newer tools are running. Use ‘EntityFramework\Enable-Migrations’ for the older version.  
Checking if the context targets an existing database…  
System.TypeInitializationException: The type initializer for ‘System.Data.Entity.Internal.AppConfig’ threw an exception. —\> System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize —\> System.Configuration.ConfigurationErrorsException: Unrecognized configuration section connectionstring. (F:\coding\EntityFramework\CodeFirstApproch\CodeFirst\App.config line 16)  
at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)  
at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)  
at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)  
— End of inner exception stack trace —  
at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)  
at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName)  
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)  
at System.Configuration.ConfigurationManager.GetSection(String sectionName)  
at System.Configuration.ConfigurationManager.get\_ConnectionStrings()  
at System.Data.Entity.Internal.AppConfig…ctor()  
at System.Data.Entity.Internal.AppConfig…cctor()  
— End of inner exception stack trace —  
at System.Data.Entity.Infrastructure.DependencyResolution.DbConfigurationManager.EnsureLoadedForAssembly(Assembly assemblyHint, Type contextTypeHint)  
at System.Data.Entity.Infrastructu

 ![App_config](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/f/fccbd9fbfcbbee544c27b2bbdb3c0dbe3a3062f0.png)  
re.Design.Executor.ScaffoldInitialCreateInternal(DbConnectionInfo connectionInfo, String contextTypeName, String contextAssemblyName, String migrationsNamespace, Boolean auto, String migrationsDir)  
at System.Data.Entity.Infrastructure.Design.Executor.ScaffoldInitialCreate.\<\>c\_\_DisplayClass0\_0.\<.ctor\>b\_\_0()  
at System.Data.Entity.Infrastructure.Design.Executor.OperationBase.\<\>c\_\_DisplayClass4\_0`1.b\_\_0()  
at System.Data.Entity.Infrastructure.Design.Executor.OperationBase.Execute(Action action)

The type initializer for ‘System.Data.Entity.Internal.AppConfig’ threw an exception.

---

<div class="post-metadata">

**Author:** ![UniqueNospaceShort](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/uniquenospaceshort/32/1814_2.png) [@UniqueNospaceShort](https://forum.codewithmosh.com/u/UniqueNospaceShort)\
**Post date:** [June 15, 2023, 6:27pm UTC](https://forum.codewithmosh.com/t/error-after-executing-enable-migration-the-type-initializer-for-system-data-entity-internal-appconfig-threw-an-exception/20819/2 "2023-06-15T18:27:07Z")

</div>

> [@Parth](#):
>
> System.Configuration.ConfigurationErrorsException: Unrecognized configuration section connectionstring.

Check your configuration for proper syntax.
