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

前端 未结 26 1174
臣服心动
臣服心动 2020-11-30 06:17

I\'m working with EF5 in a MVC 4 aspnet website. Locally, everything works just fine, but when I publish it to the IIS and try to enter, I get the error

26条回答
  •  南笙
    南笙 (楼主)
    2020-11-30 07:05

    I had this error today on a nested MVC application running as virtual folder in onother MVC application. In my case the InnerException was more informative than the main one. It was stating:

    - The entry 'DbContextMain' has already been added. (C:\inetpub\...\web.config line x)
    

    After fixing the duplicate connection strings in the nested apps everything worked fine.

提交回复
热议问题