Please Follow the below stepsStep
Create WCF Data Service.
Read below how to create WCF Data Service
and introduction to OData.http://dhananjaykumar.net/2010/06/13/introduction-to-wcf-data-service-and-odata/
creating data model to be exposed as WCF Data Service, we need to take care of
only one thing that Data model should be created as SQL Login
while creating data connection for data model connect to data base through SQL
Host WCF Data Service in IIS. WCF Data Service can
be hosted in exactly the same way a WCF Service can be hosted.
how to host WCF 4.0 service in IIS 7.5http://dhananjaykumar.net/2010/09/07/walkthrough-on-creating-wcf-4-0-service-and-hosting-in-iis-7-5/Step 3
Now we need to configure WCF Service
hosted in IIS for Windows authentication.
I have hosted WCF Data Service in WcfDataService
IIS web site.
WcfDataService and in IIS category you can see Authentication tab.
clicking on Authentication tab, you can see various authentication options.
Enable Windows authentication and disable all other authentication
enable or disable a particular option just click on that and at left top you can
see the option to toggle
by completing this step you have enabled the Windows authentication on WCF Data
Service hosted in IIS. Passing credential from .Net Client
client windows domain is having access to server then
client is not running in windows domain which is having access to server then
credential we need to pass the as below,
to fetch all the recordsProgram.cs
static void Main(string args)
NorthwindEntities1 entity = new NorthwindEntities1
entity.Credentials = System.Net.CredentialCache.DefaultCredentials;
entity.Credentials = new System.Net.NetworkCredential("UserName", "Password", "Domian");
var result = from r in entity.Products select r;
foreach (var r in result)
catch (DataServiceQueryException ex)
In above article we saw how
to enable Windows authentication on WCF Data Service and then how to consume
from .Net client. In next article we will see how to consume Windows
authenticated WCF Data Service from SilverLight client.