Skip to content

MetadataException: Unable to load the specified metadata resource

February 8, 2013

As I continued to build and test a web service using the WorldDataService I worked on yesterday, I had made a number of significant changes to the web service to provide 1) a List of strings and 2) provide XML format as output based on the WorldDataService.

However this error had been showing up all the time since that change : –

MetadataException: Unable to load the specified metadata resource

I had tried to change the output data in the web service hoping it would fix it but to no prevail.

After searching on this error. The main reason why Visual Studio throws this error is due to 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.

For me however it was one simple change in the web config file, and that was to remove metadata=res reference from

connectionString=”metadata=res:///Model.Project.csdl|res:///Model.Project.ssdl|res://*/Model.Project.msl;

to

connectionString=”metadata=res://*/;

This solved the problem. And don’t forget to have the provider=System.Data.SqlClient; reference otherwise you would get the error system.argumentexception: some required information is missing from the connection string.

 

 

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: