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

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

问题描述

突然间,我在实例化了我生成的 ObjectContext 类时,不断得到一个 MetadataException 。 App.Config中的连接字符串看起来正确 - 自从上次运行以来没有更改 - 我已尝试从基础数据库重新生成新模型(edmx-file),而不改变。



任何人都有任何想法?



更多详细信息:我没有更改任何属性,我没有更改任何输出程序集的名称,没有尝试将EDMX嵌入到程序集中。我只等了10个小时离开工作,直到我回来。然后它不再工作了。



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

解决方案

这意味着应用程序无法加载EDMX。有几件事情可能导致这种情况。




  • 您可能已将模型的MetadataArtifactProcessing属性更改为复制到输出目录。 >
  • 连接字符串可能是错误的。我知道你说你没有改变,但是如果你改变了其他的东西(比如说大会的名字),那仍然是错误的。

  • 你可能会使用后期编译任务将EDMX嵌入到汇编中,由于某种原因不再起作用。



总之,没有真正足够的细节给你一个准确的答案,但希望这些想法应该让你在正确的轨道。



更新:我写了一个博客文章,更完整的步骤进行故障排除。 p>

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.

Anyone have any ideas?

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.

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

解决方案

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

  • You might have changed the MetadataArtifactProcessing property of the model to Copy to Output Directory.
  • The connection string could be wrong. I know you say you haven't changed it, but if you have changed other things (say, the name of an assembly), it could still be wrong.
  • You might be using a post-compile task to embed the EDMX in the assembly, which is no longer working for some reason.

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.

Update: I've written a blog post with more complete steps for troubleshooting.

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

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