find a location for property in a new city

Thursday, 24 June 2010

Entity Framework MetadataException: Unable to load the specified metadata resource

I got a "System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation" error with a description of "System.Data.MetadataException: Unable to load the specified metadata resource. at System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.LoadResources".

This occurred when I was trying to move my Models out of my main MVC web application assembly. The main web dll is called Web and within that project is a folder called Models that is used to store all my *ahem* Models and entity data models etc. I decided to move everything in the Models folder out into its own Models assembly. I edited all the namespaces and everything built okay.

However, I was getting a runtime MetadataException when trying to view the page. What the hell is going on?!

Solution

The problem is that the connection string was incorrect. It wasn't immediately obviously with that error message but when you think about it, it makes sense.

My connection string was: connectionString="metadata=res://*/Models.Messaging.MessagingObjects.csdl|res://*/Models.Messaging.MessagingObjects.ssdl|res://*/Models.Messaging.MessagingObjects.msl;....etc"

Just so you know the metadata represents this metadata=res://{assembly}/{namespace}.{filename}.csdl|res://{assembly}/{namespace}.{filename}.ssdl|res://{assembly}/{namespace}.{filename}.msl;

Since I have moved the models around and the namespace is now different I needed to make it connectionString="metadata=res://*/Messaging.MessagingObjects.csdl|res://*/Messaging.MessagingObjects.ssdl|res://*/Messaging.MessagingObjects.msl;

Just for further understanding I could have replaced the asterix with Models since that is the name of the dll that contains my Messaging models.

Follow britishdev on Twitter

27 comments:

  1. Thanks for the post, solved my issue I was having!

    ReplyDelete
  2. Great, I had exactly the same problem right now and solved it with your help. thank you so much!

    ReplyDelete
  3. Thank you so much...did not consider it at all...

    ReplyDelete
  4. I am using model first. I generated the domain classes and moved them into a separate project. I also move the context to a separate class. I changed my app config file to add the namespace. I still get the message. I also tried adding the assembly name. That caused a different problem. I have the app config file in my model, domain and context assembly. Same config file in each case. My config file is:






    ReplyDelete
  5. Nice post, helped me figure this app out!! Thanks!!

    ReplyDelete
  6. You have found a good solution for this problem. I will use this today. Thanks for the article, and in case you'll be looking for another dll file, you can use the msvcr120.dll download https://fix4dll.com/msvcr120_dll and easy fix the problem, maybe it's just because that you have the wrong file.

    ReplyDelete
  7. Hi, I am new to EF. I created an edmx file for my project. I get the same metadata error mentioned here. To try the solutions provided here, can someone tell me how/where to find the names for the namespace and assembly?

    ReplyDelete
  8. Bài viết rất hay: Chúng tôi có các dịch vụ in ấn chuyên nghiệp sau:



    in bao bì vỏ hộp

    in hộp bìa cứng

    ReplyDelete
  9. This seems to be really great. if you are looking for AOl Customer Service then you can contat at AOl tech Support Phone Number for help. they will guide you to resolve your issue as soon as possible.

    ReplyDelete
  10. Bài viết của bạn rất hay!

    Công ty In Ấn Phúc Nguyên cung cấp các dịch vụ giá rẻ nhất tại hà nội:



    Báo giá in thùng carton giá rẻ nhất



    in bao bì tại hà nội



    in hộp cứng

    ReplyDelete
  11. This is a great inspiring article. I am pretty much pleased with your good work. You put really very helpful information.
    AOL Technical Support Number

    ReplyDelete
  12. There are many software which are continuously being introduced in the market due to technological advancements. Many companies try to launch different types of software that prove to be user-friendly and have the goal of achieving its maximum popularity. Telecom company AOL Inc. is quite well known and known for delivering elite quality products and services in the market. You need to download AOL desktop gold in your computer to enjoy seamless services by AOL. You need to visit our website http://webslivesupport.com/aol-desktop-gold/
    Download AOL desktop gold
    AOL desktop gold download
    Download and install AOL desktop gold

    ReplyDelete
  13. If you need support related to your AOL mail, whether it is a normal login, password, email attachment, password reset, email configuration and other issues, you can contact us by dialing our AOL email support phone number. Our expert team listens carefully to our customers and fixes their email errors step by step. We provide services through many methods such as calls, chat and remote access. Our team is highly experienced, skilled and dedicated to our email support services. Just visit our website http://webslivesupport.com/aol-desktop-gold/
    Download AOL desktop gold
    AOL desktop gold download
    Download and install AOL desktop gold



    ReplyDelete
  14. It is not uncertain whether users may encounter problems while using email services and during a certain period of time they may encounter an error during a critical period. But, this can be dealt with soon, all you need to do is dial an email support number to get an email help and get rid of the problem.You need to visit our website http://webslivesupport.com/
    email support number
    email customer care numberr
    Download AOL desktop gold
    AOL desktop gold download



    ReplyDelete
  15. hello,Its really nice post.Thanks For sharing a good post.Something else I would like to talk about is that Max Global Support.Do you know how to return a DIRECTV receiver? If you would like to know how you need to return DIRECTV equipment,you need to know which ones AT&T wants back. It’s a simple process where you can return DIRECTV equipment to the company.Just click here to follow the steps… DirecTV return equipmentand also call on toll free technical support phone number +1-888-957-7111, to solve your problem within a minutes.

    ReplyDelete
  16. These are the places that you can look for to explore in Louisville. Plan your next journey with us and save on your budget at American Airlines official site. Explore Louisville this winter and explore with us, save a lot on American Airlines.

    ReplyDelete
  17. Don’t let your budget plan tips for you-take control and plan your dream trip. Book air-tickets through United Airlines Official Site and save up to 30% on airfare.

    ReplyDelete
  18. There has to be a reason for traveling. Book your tickets with Air China Phone Number and we can promise you that you won’t feel uncomfortable. All our flights are designed as per international standards, which is an important reason behind you to travel in Air China flights.

    ReplyDelete
  19. Air China is also known for its amazing and cooperative customer service. Air China Customer Service helps you to experience the best travel, and you can also make some amazing memories by planning your travel with Air China through Air China Customer Service.

    ReplyDelete
  20. Dial Southwest Phone Number and get best offers for every booking and fly with the cheap rates only with southwest airlines. you can enjoy at your amazing destinations. Our agents are there to help with best solutions over the Southwest Phone Number.

    ReplyDelete
  21. Ensure a perfect journey with us with your airfares marked down with the biggest discounts. Call us at American Phone Number and relish your journey.

    ReplyDelete
  22. Harmony in the arms of a beautiful woman can change the landscape of a man’s life and he might feel levitated because of her company in a romantic way; Bangalore Escorts Service. Seduction process is a tedious job and efforts it requires before the wasteful body structure is infinite before the eyes of the almighty. Turbulence in the work space is usually because of different personalities trying too hard to show their dominating nature to the other individuals at the same space; Bangalore Escorts. Hey my name is Kiran Bajaj and this is my story and I am sticking to it. The story also allows some benevolent features of a woman to explode in the sanctity of erotic pleasure. I have dedicated my life to the needs of troubled men who were never appreciated in their life to a point that it exploits the desires in a wrong sense and hence the differential aspects emerge without any intentions; Bangalore Call Girls. Overly sophisticated women prefer men of high caliber who understand them for who they are not they want them to be. The society dictates the values of gnarled ethics of human commitment are threatened by the fake feminists of the world. Radical left of the political discussion leans on the destructive ropes of the rings while the sensible tries to dodge their presence with utmost elegance.

    ReplyDelete
  23. Hie I am, David william working for Southwest Phone Number Get the most sensible flight We are a group that has an information about the working example of the market. We likewise offer the most dependable help to every one of our customers. For consistently on point and solid call Southwest Airlines Phone Number.

    ReplyDelete
  24. Permainan Sabung Ayam tentunya sudah pada tahu ya, yang dimana ayam melawan ayam pertandingan yang sangat seru ini bisa kalian nonton secara live lohh, banyak yang bermain di situs kami dan merasa sangat nyaman, bagi kalian yang ingin bermain bisa kunjungi situs kami, dijamin kalian akan merasa sangat senang.

    download s128 apk mobile

    aplikasi s128 terbaru

    link download s128 apk

    link s128 apk

    cara download sabung ayam

    cara download s128 apk

    cara download aplikasi s128


    daftar judi adu ayam

    daftar adu ayam

    cara daftar s128

    cara daftar sabung ayam

    cara daftar sabung ayam s128

    cara daftar s128 sabung ayam

    cara daftar s128 apk


    login link alternatif s128

    link login alternatif s128

    ReplyDelete