實體框架無法加載指定的元數據資源[duplicate]

[英]entity framework Unable to load the specified metadata resource [duplicate]


Possible Duplicate:
MetadataException: Unable to load the specified metadata resource

可能的重復:MetadataException:無法加載指定的元數據資源

I hope someone can help with this. i have tried following other posts on here and dozens on other sites but i can get this working.

我希望有人能幫忙。我已經嘗試過在這里跟蹤其他的文章和其他網站上的幾十個,但是我可以讓這個工作。

the entity framework was all working, then the next day just started giving me the error: Unable to load the specified metadata resource. on the constructor of the entities class.

實體框架都在工作,第二天就開始出錯:無法加載指定的元數據資源。在實體類的構造函數上。

I have checked the connection strings, deleted and re added everything but i still cant get this working.

我檢查了連接字符串,刪除並重新添加了所有內容,但是我還是不能讓它工作。

my model namespace is WraithNath.co.uk.Models

我的模型命名空間是WraithNath.co.uk.Models。

the metadata artificat is embed in assembly

元數據技術嵌入到程序集中

my connection strings are as follows:

我的連接字符串如下:

<add name="ConnectionString" connectionString="Data Source=.\SQL2008;AttachDbFilename=|DataDirectory|\WraithNath.co.uk.mdf;Integrated Security=True;" providerName="System.Data.SqlClient" />
   <add name="Entities" connectionString="metadata=res://*/Models.WraithNath.co.uk.csdl|res://*/Models.WraithNath.co.uk.ssdl|res://*/Models.WraithNath.co.uk.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\SQL2008;AttachDbFilename=|DataDirectory|\WraithNath.co.uk.mdf;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />

I cant find the 3 files i need in the assembly when looking at it in Reflector.

我在Reflector里面找不到我需要的3個文件。

Is there a step by step guide to sort this out? i have already tried every link on the first 3 pages of google for search results 'entity framework Unable to load the specified metadata resource'.

是否有一步一步的指導來解決這個問題?我已經嘗試了谷歌前3頁的每個鏈接,搜索結果的“實體框架無法加載指定的元數據資源”。

1 个解决方案

#1


160  

Craig Stuntz has written an extensive (in my opinion) blog post on troubleshooting this exact error message, I personally would start there.

Craig Stuntz寫了一篇關於故障診斷的博文(在我看來),我個人將從這里開始。

The following res: (resource) references need to point to your model.

(資源)引用需要指向您的模型。

<add name="Entities" connectionString="metadata=
    res://*/Models.WraithNath.co.uk.csdl|
    res://*/Models.WraithNath.co.uk.ssdl|
    res://*/Models.WraithNath.co.uk.msl;

Make sure each one has the name of your .edmx file after the "*/", with the "edmx" changed to the extension for that res (.csdl, .ssdl, or .msl).

確保每個文件在“*/”之后都有.edmx文件的名稱,並將“edmx”更改為該res(的擴展名)。csdl、.ssdl或.msl)。

It also may help to specify the assembly rather than using "//*/".

它也可以幫助指定程序集,而不是使用“//*/”。

Worst case, you can check everything (a bit slower but should always find the resource) by using

最壞的情況是,您可以通過使用來檢查所有東西(稍微慢一點,但應該始終找到資源)。

<add name="Entities" connectionString="metadata=
        res://*/;provider= <!-- ... -->

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2011/01/19/73006048389227e742c2fc34eeaa8a02.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com