Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WCF and WF
  4. Allowing Impersonation on WCF Duplex Channel

Allowing Impersonation on WCF Duplex Channel

Scheduled Pinned Locked Moved WCF and WF
helpcsharpwcfsecurityquestion
1 Posts 1 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alex1205
    wrote on last edited by
    #1

    I've tried to allow impersonation on a WCF duplex channel, however it is always complaining (InvalidOperationException at runtime) that one of my callback method does not allow impersonation. Sample code below: [ServiceContract(Namespace = "MyNamespace", SessionMode = SessionMode.Allowed, CallbackContract = typeof(IMyContractCallback))] public interface IMyContract { [OperationContract(IsOneWay = false)] void Method1(string param); } public interface IMyContractCallback { [OperationContract(IsOneWay = false)] ReplyData Callback1(); } [DataContract(Namespace = "MyNamespace")] public class ReplyData { public ReplyData(object data) { this.data = data; } [DataMember] public object data; } Implementation: Set service host ImpersonateCallerForAllOperations to true: serviceHost.Authorization.ImpersonateCallerForAllOperations = true; Allow impersonation to Implementing Methods: [OperationBehavior(Impersonation = ImpersonationOption.Allowed)] public void Method1(string param) { ... } [OperationBehavior(Impersonation = ImpersonationOption.Allowed)] public ReplyData Callback1() { ... } I always got the error message below: System.InvalidOperationException: The service operation 'Callback1' that belongs to the contract with the 'IMyContract' name and the 'MyNamespace' namespace does not allow impersonation. at System.ServiceModel.Dispatcher.SecurityValidationBehavior.WindowsIdentitySupportRule.Validate(ServiceDescription description) at System.ServiceModel.Dispatcher.SecurityValidationBehavior.System.ServiceModel.Description.IServiceBehavior.Validate(ServiceDescription description, ServiceHostBase serviceHostBase) at System.ServiceModel.Description.DispatcherBuilder.ValidateDescription(ServiceDescription description, ServiceHostBase serviceHost) at System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost) at System.ServiceModel.ServiceHostBase.InitializeRuntime() at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open() Did I forgot to set something? Thanks in advance for the help. :)

    (:)

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups