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.

AllowedImpersonationLevel = TokenImpersonationLevel.Delegation Stopped Working on Version Later Than v4.4.2

See original GitHub issue

Describe the bug

I have a WCF client with settings as below:

var binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;

var address = new EndpointAddress($"https://myserviceendpoint.com/service.asmx");

var channelFactory = new ChannelFactory<T>(binding, address);
channelFactory.Credentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Delegation;

It works fine on WCF packages v4.4.2. But when I updated the packages version to v4.7.0 (Latest stable at the time of writing) then it seems like the ImpersonationLevel = TokenImpersonationLevel.Delegation is not working anymore.

My code still compiles, but I got an error thrown from the web service side related to the impersonation settings.

Referenced packages:

System.ServiceModel.Duplex
System.ServiceModel.Http
System.ServiceModel.NetTcp
System.ServiceModel.Security

Additional context The web service that I am consuming is built using .NET asmx web service technology. With system.web settings as below:

<authentication mode="Windows"/>
<identity impersonate="true"/>

No other security settings are involved in this scenario.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
StephenBonikowskycommented, Feb 24, 2020

@AbeBaehaki thanks for reporting this. Looks like this is a problem with SocketsHttpHandler that WCF depends on. We will investigate further and update this issue with our findings.

In the meantime as a workaround could you try adding AppContext.SetSwitch(“System.Net.Http.UseSocketsHttpHandler”, false); at the start of your app?

0reactions
HongGitcommented, Nov 11, 2021

@mconnew gentle ping?

Read more comments on GitHub >

github_iconTop Results From Across the Web

WindowsClientCredential.AllowedImpersonationLevel ...
This property specifies the impersonation level granted by the client to the server when using Windows SSPI Negotiate authentication. Note that the ...
Read more >
c# - Problems passing delegated credentials with WCF
What we are trying to do is, to have a WCF service, using WSHttpBinding, sitting on Server A that, when called, takes the...
Read more >
https://raw.githubusercontent.com/dotnet/samples/m...
NET framework (4, 4.6) it works. The same code in .net core 2 throws `NullReferenceException`. The problem has something to do with column...
Read more >
K2 blackpearl Services Reference 1 - PDF Free Download
Iterate through the category server building endpoints with SmartObject bindings for every category and subcategory found that has not specifically been marked ...
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