ASP.NET MVC 3 - Unable to find the requested .Net Framework Data Provider

前端 未结 13 1226
名媛妹妹
名媛妹妹 2020-12-24 01:37

Background-info:

I\'m using Microsoft Visual Web Developer 2010 Express.
Info about my (lack of) experience: the problem occured with

相关标签:
13条回答
  • 2020-12-24 02:14

    After reading other discussions around the web I have found another method. If you do not add the connection string until after you have created the controller class, then it will work also. It kind of seems like a bug.

    0 讨论(0)
  • 2020-12-24 02:18

    If you look at the config you'll see that installing SQL Server was a red herring;

    <add name="MovieDBContext"
     connectionString="Data Source=|DataDirectory|Movies.sdf"
     providerName="System.Data.SqlServerCe.4.0"/>
    

    SqlServerCE is not, I'm afraid, full blown SQL Server, it's SQL Server Compact Edition. I would have thought that would have been installed with VS Express, however you can download the specific installers from here

    I actually had both SQLServerCE and Express installed, but the tutorial used Compact Edition: One step within part 4 of the tutorial is to explicitly add the part you quoted to the Web.config. So this is a part of the web.config by intention.

    But deleting this part from the web.config makes it possible to add the Controller in the way the tutorial described it. While this means no longer exactly following the tutorial, it's fine for me. (This results in the creation of an MvcMovie.Models.MovieDBContext database in SQL Server Express.)

    0 讨论(0)
  • 2020-12-24 02:19

    Install Microsoft SQL Server Compact 4.0. The link for same is - http://www.microsoft.com/en-us/download/details.aspx?id=17876

    0 讨论(0)
  • 2020-12-24 02:20

    Rebuilding the project wont catch config errors in the DBContext section... the build process does not walk through connections, so you can build all day and still bomb out. As suggested above, fix the config so the connection string matches MachineName/SQLInstanceName/DBName with the correct SQL config. Worked just fine by just modifying my web.config in my solution.

    0 讨论(0)
  • 2020-12-24 02:21

    http://forums.asp.net/t/1679349.aspx/1 CypressBender

    Re: Unable to retrieve metadata for * Unable to find the requested .Net Framework Data Provider.... Aug 08, 2011 07:44 PM|LINK

    I installed Microsoft SQL Server Compact 4.0, and that fixed the problem for me. http://www.microsoft.com/download/en/details.aspx?id=17876

    0 讨论(0)
  • 2020-12-24 02:21

    Try this:

    <add name="MovieDBContext"
         connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|Movies.sdf;User Instance=true"
         providerName="System.Data.SqlClient" />
    
    0 讨论(0)
提交回复
热议问题