MetadataException: 无法加载指定的元数据资源 [英] MetadataException: Unable to load the specified metadata resource

查看:27
本文介绍了MetadataException: 无法加载指定的元数据资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

突然间,我在实例化生成的 ObjectContext 类时不断收到 MetadataException.App.Config 中的连接字符串看起来正确 - 自上次工作以来没有改变 - 我已经尝试从底层数据库重新生成一个新模型(edmx 文件)而没有任何变化.

All of a sudden I keep getting a MetadataException on instantiating my generated ObjectContext class. The connection string in App.Config looks correct - hasn't changed since last it worked - and I've tried regenerating a new model (edmx-file) from the underlying database with no change.

有人有什么想法吗?

更多细节:我没有更改任何属性,我没有更改任何输出程序集的名称,我没有尝试在程序集中嵌入 EDMX.我从下班到回来只等了 10 个小时.然后就不行了.

Further details: I haven't changed any properties, I haven't changed the name of any output assemblies, I haven't tried to embed the EDMX in the assembly. I've merely waited 10 hours from leaving work until I got back. And then it wasn't working anymore.

我尝试重新创建 EDMX.我试过重新创建该项目.我什至尝试从头开始重新创建数据库.没有运气,无论如何.

I've tried recreating the EDMX. I've tried recreating the project. I've even tried recreating the database, from scratch. No luck, whatsoever.

推荐答案

这意味着应用程序无法加载 EDMX.导致这种情况的原因有很多.

This means that the application is unable to load the EDMX. There are several things which can cause this.

  • 您可能已将模型的 MetadataArtifactProcessing 属性更改为复制到输出目录.
  • 连接字符串可能有误.我知道你说你没有改变它,但如果你改变了其他的东西(比如程序集的名称),它仍然可能是错误的.
  • 您可能正在使用编译后任务将 EDMX 嵌入到程序集中,但由于某种原因该程序不再起作用.

简而言之,您的问题中没有足够的细节来给出准确的答案,但希望这些想法能让您走上正轨.

In short, there is not really enough detail in your question to give an accurate answer, but hopefully these ideas should get you on the right track.

更新:我写了 一篇博文,其中包含更完整的故障排除步骤.

这篇关于MetadataException: 无法加载指定的元数据资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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