Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

While trying to refer "ListData.svc" service in my VS.NET WinForm project, I am getting an error

The HTML document does not contain Web service discovery information.
Metadata contains a reference that cannot be resolved: 'http://sp2010/_vti_bin/ListData.svc'.
The requested service, 'http://sp2010/_vti_bin/ListData.svc' could not be activated. See the server's diagnostic trace logs for more information.
If the service is defined in the current solution, try building the solution and adding the service reference again.

I tried my best to sort this out, but nothing turned to work out.

Inorder to test the ListData.svc service, I tried pasting the URL "http://sp2010/_vti_bin/ListData.svc" to a browser. The service works as expected by displaying the XML output. This only happens if I am logged on to the same sharepoint site, in any other tab, inside the same browser window. At the same time if I am to paste the "http://sp2010/_vti_bin/ListData.svc" url to a new browser window(after closing all other browser instances), the following error message is shown "Correlation ID: 1e2e1126-d4f8-451e-8103-3040f2b5814a" at the same time the URL contains the error message "Object reference not set to an instance of an object".

In the Event Viewer I came to find the following error "Exception: System.ServiceModel.ServiceActivationException: The service '/_vti_bin/ListData.svc' cannot be activated due to an exception during compilation." while searching on this error. I came to find that this might be because of WCF 1.5 Data Services wan't installed, I download the patch (Windows6.1-KB976127-v6-x64) and while trying to install the following message was displayed "The update is not applicable to your computer."

Following were the steps I had executed to refer this service in my WinForm project in VS.NET 2010

-Created a new WinForm project with Target framework set as "3.5"

-Change the platform to "x64" in project properties.

-Selected "Add Service Reference" from solution explorer.

Following is my development environment configuration

  1. Sharepoint Server 2010 is installed on my development machine itself.

  2. I am using the same username to login to my system and to the Shapoint site as well as to cental admin.

  3. While logging on to sharepoint sites, I am prompted with the username and password dialog to which I pass the same username and password with which I had logged on my system.

  4. I am developing on Windows Server 2008 R2 64 bit.

To me it felt like there's some problem with permissions, but couldn't sort out what exaclty needs to be done.

Please help.

Update 1: I tried installing WCF Data Services CTP2 v1.5 and rebooted. But the problem still persists. I am able to access "http://sp2010/_vti_bin/Lists.asmx" without any errors from the browser and from VS.NET, but the error with ListData.svc still remains.

Update 2: Seems like I had found the root cause to this. The problem shows only for web applications whose "Security Configuration" is set to "Allow Anonymous to Yes". If I create a new web application in SharePoint with "Allow Anonymous to No" then this issue doesn't show up.

Following were the "Security Configuration" settings which had created all these problems.

Authentication Provider: NTLM
Allow Anonymous: Yes
Use Secure Socket Layers: No

I am still not sure whether "Allow Anonymous to Yes" was the real culprit or not. I was able to access ListData.svc in a new sharepoint 2010 web application when "Allow Anonymous" was set to "No".

share|improve this question
    
When you open up sp2010/_vti_bin/listdata.svc does it return an xml document like: <service xml:base="sparked-dev/_vti_bin/listdata.svc/"; xmlns:atom="w3.org/2005/Atom"; xmlns:app="w3.org/2007/app"; xmlns="w3.org/2007/app">; <workspace> <atom:title>Default</atom:title> <collection href="Announcements"> <atom:title>Announcements</atom:title> </collection> ... etc etc... –  Roel Hans Bethlehem Jun 16 '11 at 15:06
    
Yes its returning the XML data as you had mentioned. –  AbrahamJP Jun 16 '11 at 15:38
    
Yes when I turn Disable Anonymous Access Off VS2012 doesn't have a problem adding a service reference. –  Ben_Coding Sep 5 '13 at 21:48

2 Answers 2

up vote 5 down vote accepted

Finally got it working after some changes in IIS under authentication section for "_vti_bin" directory. Set "Anonymous Authentication" to Disabled and "Basic Authentication" to "Enabled". For time being this setting worked for me; not sure whether this is going to work every time.

enter image description here

share|improve this answer
    
it's odd because I have just installed a SharePoint and I had by default the Anonymous Authentication set to Disabled, Basic Authentication to Disabled and Windows Authentication to Enabled –  GillouX Jun 17 '11 at 10:13
    
@GillouX: Yes this seems odd to me too. I had updatied my findings in the post, before coming up to this solution. –  AbrahamJP Jun 18 '11 at 5:32

could you try running these update rather ?

http://www.microsoft.com/download/en/details.aspx?id=8165

it has an earlier published date

because you should be able to run this exe on your system.

share|improve this answer
    
Yes I will try that. –  AbrahamJP Jun 16 '11 at 15:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.