我正在学习使用.NET MVC 3和C#进行开发。我尝试使用“Code First”方法创建一个应用程序,但是当我尝试从我的数据库中获取数据时,我收到了一个错误消息:“提供程序未返回ProviderManifestToken字符串”。
我看过一些关于此错误的帖子,但是在这些帖子中找不到适合我的解决方案。
我正在使用Windows 7 64位上的MS Visual Web Developer Express 2010。我的数据库使用SQL Compact Server 4.0。
当运行以下代码时,将触发该错误:
我看过一些关于此错误的帖子,但是在这些帖子中找不到适合我的解决方案。
我正在使用Windows 7 64位上的MS Visual Web Developer Express 2010。我的数据库使用SQL Compact Server 4.0。
当运行以下代码时,将触发该错误:
public class StoreController : Controller
{
MusicStoreEntities storeDB = new MusicStoreEntities();
//
// GET: /Store/
public ActionResult Index()
{
var genres = storeDB.Genres.ToList(); // This line causes the error
return View(genres);
}
}
我的DbContext类如下:
public class MusicStoreEntities : DbContext
{
public DbSet<Album> Albums { get; set; }
public DbSet<Genre> Genres { get; set; }
}
我的连接字符串:
<connectionStrings>
<add name="MusicStoreEntities"
connectionString="Data Source=|DataDirectory|MvcMusicStore.sdf"
providerName="System.Data.SqlServerCe.4.0"/>
</connectionStrings>
有什么看起来不对的吗?如果需要更多信息,请随时询问。
谢谢