1

I have a SharePoint site that allows anonymous access (entire website). The site is up and running for a while now without any problems.

Now, I have created a WCF service (not REST) hosted in IIS that tries to retrieve data from the SharePoint site. I thought that since web application is anonymous, I would not have any issues retrieving the data. However, every time the application tries to open the web and tries to get a list I get an access denied.

Is it possible to retrieve data from an anonymous site using a WCF? If I use elevated I can get the data, but I do not want to use elevated as I have a publishing site and I want to retrieve only published data. Any ideas or suggestions?

2 Answers 2

0

According to MSDN forum, you need to provide anonymous access at three level, i.e. Web Application Level, Site Collection Level and finally to the desired List and Library.

Check the following post.

https://social.msdn.microsoft.com/Forums/sharepoint/en-US/39217521-f037-4e87-9441-68be1178753a/how-to-grant-anonymous-access-on-sharepoint-document-librarylist-only-not-for-web-application?forum=sharepointdevelopment

2
  • As I said, the site is up and running fine with anonymous access for a while now. It is not an issue with the anonymous permission on a site or a list level. As an anonymous from a browser I can open and view the specific items. I want to do the same from a WCF service, using a server side code.
    – PoppyAnc
    Commented May 30, 2017 at 9:48
  • Did you tried disabling site collection feature named as "Limited-access user permission lockdown mode"? Once try that, may it help. Commented May 30, 2017 at 10:37
0

I presume you are using CSOM in your WCF service to access the SharePoint site.

CSOM (and REST APIs) are not available by default to anonymous users. You need to uncheck the Require Use Remote Interfaces permission checkbox in your SharePoint site settings > Site Permissions > Anonymous access (ribbon button).

Reference: https://blogs.msdn.microsoft.com/kaevans/2013/10/24/what-every-developer-needs-to-know-about-sharepoint-apps-csom-and-anonymous-publishing-sites/


If your WCF service and SharePoint run on the same domain, then I suggest you better use an AD account that has access to the SP site and that is used to run the IIS application pool where the WCF service will reside in.

4
  • No I am not using CSOM. I am using a standard server side code
    – PoppyAnc
    Commented May 30, 2017 at 9:44
  • Have you then enabled anonymous access at site collection level as well, or only at the web application level? Also, see my updated answer.
    – Mihail
    Commented May 30, 2017 at 9:56
  • Anonymous access is working fine from a browser and retrieves the specific items. My WCF service is set with anonymous access only. So you think that is not possible to access anonymously, I will have to enable windows authentication on the WCF?
    – PoppyAnc
    Commented May 30, 2017 at 10:15
  • It should be possible with anonymous access although I have not tried it myself, but I still suggest you use Windows Authentication because it is more secure. It is always better to go with the more secure option for obvious reasons.
    – Mihail
    Commented May 30, 2017 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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