일반 토론 Credentials passing between two WCF windows Services

  • 2012년 3월 13일 화요일 오전 11:11
     
     

    Hi All,

    I have 2 windows based services. Lets asume Service-A and Service-B.

    Service-A internally calls Service-B. But all users uses Service-A. Service-A provides response based on called user (based on windows account). At the same time Service-B also provides the response based on called user.

    Now my querry is, how can I pass called user credentials to Service-B from Service-A. Currently I am using below code to pass client creditials from one servie to another service. But its not working. Let me know if you have any idea.

    this.serviceobj.ClientCredentials.Windows.ClientCredential = OperationContext.Current.ServiceSecurityContext.PrimaryIdentity as System.Net.NetworkCredential;


    Srinu Tamada

모든 응답

  • 2012년 3월 13일 화요일 오전 11:55
     
      코드 있음

    Add this to your method implementation:

    [OperationBehavior(Impersonation = ImpersonationOption.Required)]

    This will impersonate the caller fron Service A to Service B

    Or

    Add this to your service behavior:

    <serviceAuthorization impersonateCallerForAllOperations="true" />

    What i'm talking about comes from this article:

    http://msdn.microsoft.com/en-us/library/ff649252.aspx

  • 2012년 4월 3일 화요일 오전 9:26
     
     
    Thank you it worked for me :)

    Srinu Tamada