提供程序未返回一个字符串ProviderManifestToken - .NET MVC 3 #C [英] The provider did not return a ProviderManifestToken string - .NET MVC 3 #C

查看:3000
本文介绍了提供程序未返回一个字符串ProviderManifestToken - .NET MVC 3 #C的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习用.NET MVC 3和C#开发。我试图用一个code首先'的方法来创建一个应用程序,但是当我试图从我的数据库中提取数据,我得到一个错误信息的提供者未返回ProviderManifestToken字符串'。

I'm learning to develop using .NET MVC 3 and C#. I'm attempting to use a 'Code First' approach to create an app but when I try to pull data from my database i'm getting an error message 'The provider did not return a ProviderManifestToken string'.

我看到有关此错误的几个其他职位,但我找不到那个适合我这些帖子的解决方案。

I've seen a few other posts about this error but I can't find a solution in those posts that works for me.

我使用的Windows 7 64位MS Visual Web Developer中前preSS 2010。我使用SQL服务器紧凑4.0作为我的数据库。

I'm using MS Visual Web Developer Express 2010 on Windows 7 64bit. I'm using SQL Compact Server 4.0 as my database.

该错误时,code的该位尝试运行引发的:

The error is triggered when this bit of code tries to run:

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类如下:

My DbContext class is as follows:

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>

这有什么,看起来错了吗?如果您需要更多的信息只是问。

Is there anything that looks wrong? If you need more info just ask.

感谢

推荐答案

您只需把。在数据源LOCALMACHINE如下:

you Just need to put "." for localmachine in the data source as follows:

&LT;添加名称=MYSQLSERVER
     的providerName =System.Data.SqlClient的
     的connectionString =数据源= \\ MYSQLSERVER; Trusted_Connection =真正的&GT;&LT; /添加&gt;结果
&LT; /&是connectionStrings GT;

这篇关于提供程序未返回一个字符串ProviderManifestToken - .NET MVC 3 #C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆