Problem with adding Service Reference in VS2010

Error : Metadata contains a reference that cannot be resolved

Some of you may have faced the same issue of adding service reference to a web service in VS2010. I had the same problem with VS2010 when I try to add service reference, it gives me an error "Metadata contains a reference that cannot be resolved". But if I try to access the WSDL using a browser, I can see that WSDL is showing perfectly. For some reason (specially the web service is not in your network) this VS tool unable to generate web service proxy class. If you have same situation, you can use "svcutil" comes with the VS tools.

Just open a VS command prompt and execute the following command (format the command according to your preference)

svcutil /out:C:/MyProxyClass.cs /namespace:*,MyProject.Services.DataService

You have to replace your web service url, class file name and namespace. The proxy class generated from this is exactly same as the one is generated by the Service Reference tool in VS2010.


Popular posts from this blog

CSS text-overflow ellipsis in the beginning of the the text - Left Ellipsis using CSS in a Flex box

Selenium With .Net

Handling Exit Event of Console Application in C#