当我调试我的项目时,有 5 条消息(示例:无法找到元素“entityFramework”的架构信息。Web.config)并且应用程序无法运行(错误:无法找到请求的 .Net Framework数据提供程序。它可能未安装。)。
网络配置:
<configuration>
<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=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
<customErrors mode="Off" />
<authentication mode="None" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
<parameters>
<parameter value="Data Source=.\SQLEXPRESS ; Integrated Security=True; MultipleActiveResultSets=True" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
<connectionStrings>
<add name="HistoryContainer" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlServerCe.4.0;provider connection string="data source=|DataDirectory|\Database1.sdf"" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
并且对象“System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection”不存在。 我应该怎么办?谢谢。
最佳答案
我有一个类似的错误,我已经摆脱了它。然而,我的网络配置提到了 4.4 版本(不是你所拥有的 4.3.1),据我所知,该版本不存在。这是在我从某处或其他地方获取带有 MVC4 的 WebAPI 的入门包之后出现的。
自 2012 年 8 月起,V4.3.1 和现在的 V5.0 预发布版已经存在
我使用解决方案级别“库包管理器”获得了 4.3.1 的 nuget 包。这是重要的一步,因为我可以选择将其应用于哪些项目。
在此过程中,我的网络配置已更改(引用 4.3.1)并且问题消失了。
让我烦恼的是对“System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection”的引用因为我找不到它存在的位置但至少 VS 不再提示了。
关于c# - System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11775513/