Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HttpContext.Current.User is always null

I have a WCF service that has a method to return the Windows Username of a Silverlight client that is consuming the service . The WCF service is using basicHttpBinding with the TransportCredentialOnly mode set and the TransportClientCredentialType set to Windows. In IIS Windows authentication is enabled and anon authentication disabled.

Despite (apparently) configuring the service correctly when I call the service and ask it to return the username it errors. Closer examination shows that HttpContext.Current.User is always null (so a nullreferenceexception is thrown).

Does anyone have any other ideas why this is not working?

like image 699
Calanus Avatar asked Mar 17 '26 05:03

Calanus


1 Answers

Try adding -

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />

to your config file

like image 79
Craig Schwarze Avatar answered Mar 19 '26 06:03

Craig Schwarze



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!