Met*_*nix 2 .net c# asp.net-mvc wcf entity-framework
这里的帖子似乎都没有解决我的错误的特定版本,但我可能只是遗漏了一些东西......
情况:
MVC网站使用WCF服务.数据保存在WCF服务中.两者都在运行
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
两者都有连接字符串:
    <add name="SiteTrackerEntities" connectionString="metadata=res://*/VisitorInformation.csdl|res://*/VisitorInformation.ssdl|res://*/VisitorInformation.msl;provider=System.Data.SqlClient;provider connection string="data source=BADLANDS\;initial catalog=SiteTracker;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
站点运行,直到我实际尝试使用(第二行错误)保存到WCF服务中的数据库...
SiteTrackerEntities db = new SiteTrackerEntities();
db.Entry(visitorData).State = System.Data.Entity.EntityState.Added; 
然后我得到了这个可爱的错误:
VisitorInformation.ssdl(2,2) : error 0152: No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
providerName="System.Data.EntityClient" 我错过了什么?
确保在Web.config或App.config中有类似于以下内容的内容.
<entityFramework>
   <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
   <providers>
     <provider invariantName="System.Data.SqlClient"         type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
   </providers>
</entityFramework>
| 归档时间: | 
 | 
| 查看次数: | 10485 次 | 
| 最近记录: |