【发布时间】: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 元素:
<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.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </configSections> -
我重新创建了服务,现在标签
<providers> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> </providers>不再在文件中。谢谢
标签: wcf service frameworks entity dbcontext