In this article, we are going to see how to use membership provider with WCF.
In this article, we are going to see how to use membership provider with WCF. Let us go through this application step by step.
Create a new Website->Select a WCFService->name it as service
Here i am keeping interface as it is. In this application, we are suppose to discuss so many things.
Now we are suppose to create a forms authentication database. I suggest you to read this article, it contains information on how to create a forms authentication database
Now at this point of time lets create a certificate. Go through this article
Now lets write our web.config.
First connect to database and give the connectionstring
Now create membershipProvider in web.config
Set the authentication mode to Forms
Under System.ServiceModel write these lines in web.config
Here I will suggest you to check those imp things
1)Message credential type as UserName
2)negostiate Service credential to false
4)UserNameAuthentication->set UserNamepasswordvalidatormode=MembershipProvider and MembershipProviderName as membership. In my case membership provider name is membership.
To check the thumb print value of the certificate go through this
Now create a new console app project->name it as client
Give a service reference to Console app(client)-> name the reference as ServiceReference1
Here i am creating the proxy and setting the username and password in my case username is anup and password is AnUpHoSuR@.
Now create a service certificate in a client as you did in Service.
Its time to run your app
I hope you people like this article.
About the Author