WCF and passing windows credentials

If you use Windows authentication, you can grab the identity of the caller in your service code here:


This WindowsIdentity contains things like the ".Name" property, the ".Groups" property of all groups the user belongs to, and more.

If the WindowsIdentity should be NULL, then you don't really have Windows authentication happening.

Are you hosting your WCF service in IIS? Which version - IIS7 is the first one to support net.tcp binding.

What if you self-host your service in a console app - does Windows authentication work then? In that case, it would most likely be a IIS7 config issue of sorts.


I suspect this is because your service account is not trusted for delegation. It can therefore impersonate the caller for access to local resources, but not for calling out over TCP. Google "Trusted for delegation" for more info.


  1. Ruggiero

    • 2015/9/24

    When you set WCF to use windows authentication, by default it will try kerberos first,try specifying the WCF(authentication mode) to use NTLM.

  2. Desmond

    • 2019/3/5

    WCF and passing windows credentials. Ask Question Asked 12 years ago. Active 8 years, 6 months ago. Viewed 5k times 3 I have a website hosted on ServerA which runs

  3. Frank

    • 2021/4/10

    To configure a WCF service to authenticate using Windows domain username and password · Create an instance of the WSHttpBinding, set the security 

  4. Clyde

    • 2016/7/11

    A Login form is used to enter authentication credentials to access a restricted page or form. The login form contains a field for the username and another for the password. When the login form is submitted its underlying code checks that the credentials are authentic, giving the user can access the restricted page.

  5. Morris

    • 2018/5/14

    I'm currently hard coding the user/pass in the WCF client class library and would like to instead use Windows Authentication through IIS to pass 

  6. Skyler

    • 2016/12/3

    Hello, I am trying to enable the basicHttpBinding to use Windows for clientCredentialType when calling a wcf method. the wcf method is set to return the name of the current principal using Microsoft.IdentityModel.Claims.IClaimsPrincipal.

  7. Krasniqi

    • 2018/1/28

    Step 1: Create a WCF project · Step 2: Ensure authentication mode is Windows · Step 3: Define the binding in the web. · Step 4: Bind the bindings 

  8. Conor

    • 2016/9/23

    Turns out "Client.ClientCredentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials" may get credentials from Windows Credential Manager: I failed to find a solution to instruct WCF to avoid grabbing credentials from that storage.

  9. Jaxxon

    • 2016/12/13

    Windows authentication: In this mode the caller must provide his/her Here I am passing a Username and Password and the WCF service will 

  10. Jayceon

    • 2016/8/24

    This topic demonstrates how to enable a Windows Communication Foundation (WCF) service to authenticate a client with a Windows domain username and password. It assumes you have a working, self-hosted WCF service. For an example of creating a basic self-hosted WCF service see, Getting Started Tutorial. This topic assumes the service is

  11. Cook

    • 2015/4/22

    Configure a WCF web service to supply the client Windows Authenticated credentials through to BizTalk for further processing over SSL, 

  12. Dalton

    • 2017/4/13

    Re: Pass Windows Credentials to WCF Service. Jul 20, 2016 01:48 PM. | Chris Zhao | LINK. Hi Vijayd48, When you set WCF to use windows authentication, by default it will try kerberos first,try specifying the WCF (authentication mode) to use NTLM. Right click the "Windows Authentication" option and select "Providers".

  13. Erick

    • 2018/8/27

    The sample code to call the WCF Service by passing Network Credentials Hope it helps .. September 5, 2014. In "C#". Using JavaScript to consume 

  14. Abram

    • 2019/2/18

    Sending credentials automatically to Windows Communication Foundation (WCF) Web Service can make your client application more dynamic.

Comments are closed.

Recent Posts