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
Sharepoint Server 2010 is installed on my development machine itself.
I am using the same username to login to my system and to the Shapoint site as well as to cental admin.
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.
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".