none
Cannot initialize SSPI package error

    Question

  • Hi,

     

    I have WCF service and one of the endpoint is having wsHTTPbinding and configured to Message And Transport credential as Windows.

     

    Now on service side, I want to use Impersonation, so I am running following code in the OperationContract

     

    System.Diagnostics.Debug.WriteLine(System.Security.Principal.WindowsIdentity.GetCurrent().Name);

    if (ServiceSecurityContext.Current.WindowsIdentity.IsAuthenticated) //This is for a simple check only

    {

    using (ServiceSecurityContext.Current.WindowsIdentity.Impersonate())

    {

    System.Diagnostics.Debug.WriteLine(System.Security.Principal.WindowsIdentity.GetCurrent().Name);

    TrustedConnect();// CALL TO MAKE TRUSTED DB CONNECTION

    }

    }

    return ServiceSecurityContext.Current.WindowsIdentity.Name;

     

    After impersonation, when I call to make a Trusted connection with SQL DB, it throws above exception "Cannot initialize SSPI package".

     

    Anyone has any idea whats wrong?and why Its not working?

     

    Thanks

     

     

     

    Tuesday, June 05, 2007 3:10 PM

All replies