Ashish
Ashish

Reputation: 2564

WCF Data Services with Integrated Authentication issue

I have a web project that has Anonymous access and Integrated Windows authentication enabled. I built a WCF Data Service and since it allows only one authentication, I enabled Integrated authentication on the service. I am able to view the service in browser. However when I try to query the service for any Entity, it gives me Forbidden error. I tried to enable Anonymous access on service too, but it does not work.

Do I need to give it some other access or it is not possible to enable one authentication on the service itself keeping the project virtual directory as Anonymous and Integrated.

Update: I do no have any operations in my Data Service. For the entities, I have already set the "All" permission on all entities.

Upvotes: 0

Views: 434

Answers (1)

Jeremy
Jeremy

Reputation: 597

Only one authentication method is permitted on a WCF Data Service.

If you choose to go the Integrated Security route then you need to set the credentials after constructing the DataServiceContext.

Something like this would work for using the current user's Windows identity.

employeeEntities = new EmployeeDataService.EmployeeEntities(new Uri("http://.../employeedata.svc"));
employeeEntities.Credentials = CredentialCache.DefaultCredentials;

Upvotes: 1

Related Questions