question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ImpersonationOption.Required does not work in wsHttpBinding

See original GitHub issue

I’m trying to set [CoreWCF.OperationBehavior(Impersonation = CoreWCF.ImpersonationOption.Required)] attribute on one of the WCF service method. I’m using wsHttpBinding set up as follows:

            var binding = new WSHttpBinding();
            binding.Security.Mode = SecurityMode.Transport;
            binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;

Getting following error:

10:46:21 ERR] First chance exception occured System.InvalidOperationException: SecurityContextProperty is missing from the request Message, this may indicate security is configured incorrectly. at CoreWCF.Dispatcher.SecurityImpersonationBehavior.RunImpersonated2[T](MessageRpc rpc, ServiceSecurityContext securityContext, Boolean isSecurityContextImpersonationOn, Func`1 func) in D:\Odesk\Eddie\Radian_TFS\CoreWCF\src\CoreWCF.Primitives\src\CoreWCF\Dispatcher\SecurityImpersonationBehavior.cs:line 226

I might be doing something wrong, but client works with other service created on .Net Framework, but does not work with CoreWCF (.Net Core 5).

Attached is a patch with unit test that reproduces same issue.

0001-486-Unit-test.zip

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mconnewcommented, Apr 26, 2022

@birojnayak, it looks like you assigning it to Jon was successful.

0reactions
birojnayakcommented, Apr 26, 2022

@mconnew can you assign… I can’t assign to @jonlouie

Read more comments on GitHub >

github_iconTop Results From Across the Web

Impersionation like in ASP.NET for WCF Service
It tells me that the WsHttpBinding does not offer an identity for the contract. Am I missing something important? Edit: Translation of the...
Read more >
Delegation and Impersonation with WCF
Both impersonation and delegation require that the client have a Windows identity. If a client does not possess a Windows identity, ...
Read more >
How to: Impersonate a Client on a Service - WCF
This topic shows the basic steps required to enable a client in a Windows domain to set a client impersonation level. For a...
Read more >
Solved: URGENT - How To Enable Impersonation in WCF
Set the Impersonation property to Required. ... A Windows identity that represents the caller is not provided by binding
Read more >
WCF Impersonation and Delegation
I suspect it has something to do with adding [OperationBehavior(Impersonation = ImpersonationOption.Required)] to the service methods. I'm not ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found