Configure a WCF Service for Windows Authentication


Sharing a simple example on how to enable Windows Authentication for a WCF Service using basicHttpBinding.

We will take an example of the OOB WCF Service that gets created when we create a new WCF Service Application.

Add the following configuration in web.config

<service name="WcfService2.Service1">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="myBinding" contract="WcfService2.IService1"/>
<binding name="myBinding" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows"/>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
<add binding="basicHttpsBinding" scheme="https" />
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />


And enable Windows Authentication in IIS


Hope it helps ..

Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

One thought on “Configure a WCF Service for Windows Authentication”

Please share your thoughts

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.