【问题标题】:The element 'entityFramework' has invalid child element 'providers'. List of possible elements expected: 'contexts'元素“entityFramework”具有无效的子元素“提供者”。预期的可能元素列表:“上下文”
【发布时间】:2013-07-14 01:05:35
【问题描述】:

根据 Rainer Stropek 的 this 教程,我正在尝试从 WCF 服务中的实体框架 5.0.0 返回一个实体对象。我正在使用支持 WCF 的 EF 5.x DbContext 生成器。当我尝试调试服务时,我收到了这个警告,这会阻止它运行:

元素“entityFramework”的子元素“providers”无效。预期的可能元素列表:“上下文”。 F:\Dropbox\KelesoftSOMA\KelesoftSOMA.DataService.Administration\Web.config 40 6 KelesoftSOMA.DataService.Administration

web.config 文件如下所示:

...
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
  <parameters>
    <parameter value="v11.0" />
  </parameters>
</defaultConnectionFactory>
<providers>
  <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>

...

请帮帮我。

【问题讨论】:

  • 能否请您发布配置的 configSections 元素。
  • @LukeMcGregor 这是 configSections 元素:&lt;configSections&gt; &lt;!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --&gt; &lt;section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt; &lt;/configSections&gt;
  • 我重新创建了服务,现在标签 &lt;providers&gt; &lt;provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /&gt; &lt;/providers&gt; 不再在文件中。谢谢

标签: wcf service frameworks entity dbcontext


【解决方案1】:

这发生在我运行 vs-2013 预览版的身上。

应更新由 EFTools.msi 安装的 App.config/Web.config IntelliSense 文件以包含有效的 EF6 元素。 web/app.config 文件中“验证”EF 配置部分的 xsd 无法识别新添加的 EF6 元素。应该对其进行更新,使其不会显示有效 EF6 配置文件的曲线。

更新配置 xsd 以识别 EF6 中添加的元素(即 )。这些文件位于 Visual Studio 安装区域,如 ~“C:\Program Files (x86)\Microsoft Visual Studio 12.0\Xml\Schemas”。这不是 100% 完成 - 抱歉,我处于时间盒模式。

【讨论】:

    猜你喜欢
    • 2013-10-31
    • 1970-01-01
    • 1970-01-01
    • 2016-10-23
    • 2021-03-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-15
    相关资源
    最近更新 更多