无法检索无法识别的元素提供元数据 [英] unable to retrieve metadata for unrecognized element providers

查看:2186
本文介绍了无法检索无法识别的元素提供元数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到一个消息错误,每当我尝试与实体框架模板添加一个控制器,但我不断收到一个错误讯息

 无法检索元数据路径无法识别的元素供应商。
         (C:\\用户\\用户\\应用程序数据\\本地的\\ Temp-mp6124.tmp线78)

我知道这是涉及到连接字符串,所以这里的东西是我的连接字符串

 <&是connectionStrings GT;
    <添加名称=NoktatyContext的connectionString =数据源=(的LocalDB)\\ V11.0;初始目录= NoktatyContext-20140122154208;集成安全性= TRUE; MultipleActiveResultSets = TRUE; AttachDbFilename = | DataDirectory目录| NoktatyContext-20140122154208.mdf的providerName =System.Data.SqlClient的/>
  < /&是connectionStrings GT;


解决方案

我是能够通过删除&LT来解决这一问题;供应商> 配置文件的部分。

 <&的EntityFramework GT;
  < defaultConnectionFactory TYPE =System.Data.Entity.Infrastructure.SqlConnectionFactory,的EntityFramework/>
  <供应商>
    <供应商invariantName =System.Data.SqlClient的TYPE =System.Data.Entity.SqlServer.SqlProviderServices,EntityFramework.SqlServer/>
  < /供应商>
< /&的EntityFramework GT;

这变为:

 <&的EntityFramework GT;
  < defaultConnectionFactory TYPE =System.Data.Entity.Infrastructure.SqlConnectionFactory,的EntityFramework/>
< /&的EntityFramework GT;

今早我这个问题,只是发现的修补程序。如果不指定数据库(和提供我猜)EF将默认为SQL Server的防爆preSS。

I get a message error whenever I try to add a controller with Entity framework template but I keep getting a error message

    unable to retrieve metadata for 'path' unrecognized element providers. 
         (C:\Users\user\appdata\local\Temp-mp6124.tmp line 78)

I know it's something related to connection string so here is my connection string

  <connectionStrings>
    <add name="NoktatyContext" connectionString="Data Source=(localdb)\v11.0; Initial Catalog=NoktatyContext-20140122154208; Integrated Security=True; MultipleActiveResultSets=True; AttachDbFilename=|DataDirectory|NoktatyContext-20140122154208.mdf" providerName="System.Data.SqlClient" />
  </connectionStrings>

解决方案

I was able to fix this issue by removing the <providers> section of the configuration file.

This:

<entityFramework>
  <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
  <providers>
    <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
  </providers>
</entityFramework>

Becomes this:

<entityFramework>
  <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>

I had this issue this morning and just found the fix. If you don't specify the database (and provider I guess) EF will default to SQL Server Express.

这篇关于无法检索无法识别的元素提供元数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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