EF 4.1 exception “The provider did not return a ProviderManifestToken string”

后端 未结 15 1000
闹比i
闹比i 2020-11-30 05:02

I am trying to replicate an example found on MSDN. I am using ASP.NET and EF 4.1 (CTP?). I\'ve used NuGet to install the EntityFramework package.

I am getting this e

相关标签:
15条回答
  • 2020-11-30 05:47

    One other thing to consider if you're using EF Code First is that it sometimes doesn't automatically create the backing database to your DbContext class. The solution is to add your own connection string - you can use the connection string that may be present to handle the user/registration database that backs the Simple Membership Provider, as a template. Finally, you will need to add a default constructor for the DbContext class you created:

    public ChaletDb():base("ChaletConnection")
        {
    
        }
    

    Here, the name of the connection string as you entered in your web.config file is used to direct the DbContext to create the database. Very occasionally, I've had to manually create the database (in SQL Server Management Studio) which prompted it to work.

    0 讨论(0)
  • 2020-11-30 05:48

    I had a similar issue with the MvcMusicStore app. I changed a line in the Web.config from "Instance=true" to "Instance=false". It sometimes works without this tweak but I don't know what causes the difference. Reading this http://msdn.microsoft.com/en-us/library/ms254504.aspx didn't really help.

    0 讨论(0)
  • 2020-11-30 05:51

    I was just having the same problem...
    the solution that worked for me was:
    run the client network configuration tool (type cliconfg in Run)
    and make sure TCP/IP is enabled..

    0 讨论(0)
  • 2020-11-30 05:55

    This error is only present while the .edmx file is open and disappears as soon as the file is closed again.

    This quote from CodePlex , this worked with me (visual studio 2013 /MVC 5)

    0 讨论(0)
  • 2020-11-30 05:55

    I had a error for entity framework, but none of the above answers ended up fitting into the solution that finally worked.

    My EntityFramework Code First Models and DataContext were in a Separate project from my WebAPI Main Project. My Entity Framework Project somewhere down the line of coding was set as the startup project and therefore when I was running a migration I was getting “The provider did not return a ProviderManifestToken string” ... connection issue.

    Turns out that since the ConnectionString to the DB is located in the Web.config file in WebAPI Main project, that when I was running a migration the connection string was not being retrieved. By setting WebAPI project as my startProject I was able to successfully connect.

    0 讨论(0)
  • 2020-11-30 05:59

    I was having same error, and actually it was login failed for the specified server. I removed "Integrated Security" attribute from the config connection string and it worked.

    0 讨论(0)
提交回复
热议问题