Role authorization in WCF is not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rameshkartik
    New Member
    • Apr 2015
    • 1

    #1

    Role authorization in WCF is not working

    Hi all,

    I have created a WCF service which has one service method should be accessible only for the administrators. But am getting an error message like Request for principal permission failed.

    Kindly help me on this.

    Details
    -------
    Authentication : Windows

    Server Side Code
    ----------------
    [PrincipalPermis sion(SecurityAc tion.Demand, Role="BUILTIN\\ Administrator")]
    public class ISecuredMessage ServiceImpl : ISecuredMessage Service


    Client Side Code
    ----------------
    EndpointAddress endpoint = new EndpointAddress ("http://localhost:8735/Rameshkartik/WCFSamples/SecuredMessageS ervice");
    WSHttpBinding binding = new WSHttpBinding() ;
    binding.Securit y.Mode = SecurityMode.Me ssage;
    binding.Securit y.Message.Clien tCredentialType = MessageCredenti alType.Windows;
    SecuredMessageS erviceClient ProxyRefrence = new SecuredMessageS erviceClient(bi nding, endpoint);
    ProxyRefrence.O pen();
    System.AppDomai n.CurrentDomain .SetPrincipalPo licy(System.Sec urity.Principal .PrincipalPolic y.WindowsPrinci pal);
    ProxyRefrence.S aySecuredMessag e("Ramesh");

    Kindly help me on this
Working...