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

當使用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.

當我把上面的代碼註釋後,就可以正常使用了,具體原因尚不清楚,先記錄下來吧,也許會對你有用.


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章