1

I am learning Entity Framework and trying to create a sample code using Code first approach. While running this code i am getting above mention error. I am developing code on VS 2012 and database is Microsoft SQL Server. it also shows error message as "Unable to find the requested .Net Framework Data Provider. It may not be installed."

I've developed 3 class files and one of this file is for interacting with database which throws error at:

 public List<Standard> GetStandards()
 {
 StandardDBContext standardDBContext = new StandardDBContext();
 return standardDBContext.Standard.Include("Student").ToList();
 }
My web.config file:
 <connectionStrings>
 <add name="StandardDBContext" connectionString="server=CPC2\SQLEXPRESS; database=SchoolDatabase;User Id=sa;Password=password; integrated security=true" providerName="System.Data.SqlClient;" />
 </connectionStrings>
 <system.data>
 <DbProviderFactories>
 <add name="SqlClient Data Provider" invariant="System.Data.SqlClient" description=".Net Framework Data Provider for SqlServer" type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
 </DbProviderFactories>
 </system.data>
 <entityFramework>
 <!--<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
 <parameters>
 <parameter value="System.Data.SqlServerCe.4.0"/>
 </parameters>
 </defaultConnectionFactory>-->
 <providers>
 <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
 </providers>
 <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
 </entityFramework>

Can any one please help me. Your help will be appreciated.

asked Jun 25, 2015 at 12:26
4
  • Check to see if EntityFramework.SqlServer.dll is in your /bin folder. If it's not, you might want to first try reinstalling the EF nuget package. stackoverflow.com/questions/21157069/… Commented Jun 25, 2015 at 15:59
  • Hi Steve, I've already included EntityFramework.sqlserver.dll in my folder. And tried the link to get the solution but still it is not solved. Can you please help me to get this project run. Commented Jun 26, 2015 at 8:01
  • 1
    Have you tried removing EF and cleaning out the web.config and starting over? Are you referencing from a web forms/mvc project or from a data layer? Commented Jun 27, 2015 at 16:07
  • Thanks for your help @Steve, i figured it out solution that made mistake in connection string with data source. So i configured it and it works fine. I appreciate your help. Thanks again for your precious time. Commented Jun 29, 2015 at 6:07

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.