RSS
 

RoleService not working

05 Feb

The WCF Authentication Service is great to use and it works perfectly… however, I had a lot of problems trying to get the roleservice working.

WCF Role Service is not returning any results. Anything is well configured as described on MSDN: How to: Enable the WCF Authentication Service.

I could call the role service without a problem but there weren’t any queries launched at the database.
After a long search on the internet and msdn, I finally found a small MSDN Note that says the following.

Do not call the GetRolesForCurrentUser method from code that is executing on the Web server. You call the GetRolesForCurrentUser method only as part of a WCF service. For more information about how to read a user’s roles in code that is executing on the Web server, see the GetRolesForUser method.

Why I’m using the roleservice from my ASP.Net application is hard to explain… it’s related to the fact that silverlight, sharepoint login form and custom asp.net websites are using the same webservice. We want to limit the configuration of the Membership and have our forms based user object at WCF level.

So when you’re calling this service from a client application (Silverlight), it will work. If you’re calling this from a server application like ASP.Net, you just don’t get any results back… You should use the Membership classes on your custom WCF Service in order to write your own role methods.

 

Leave a Reply