当使用EF时,配置文件中会多出下面的配置代码:
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
然后在访问EF的时候会报下面的错误:
The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception.
当我把上面的代码注释后,就可以正常使用了,具体原因尚不清楚,先记录下来吧,也许会对你有用.