WCF Authentication using SQL Membership Provider


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 1 of 1

Thread: WCF Authentication using SQL Membership Provider

Threaded View

  1. #1
    Join Date
    Jan 2009
    Posts
    0

    WCF Authentication using SQL Membership Provider

    I'm working on a service based project and I'm trying to implement a level of security on my service (I.E. Authentication). My service is implemented using WCF technology.
    I'm using WSHttpBinding and Message Security Mode like this:
    Code:
          <wsHttpBinding>
            <binding name="wsHttpEndpointBinding">
              <security mode="Message">
                <message clientCredentialType="UserName" />
              </security>
            </binding>
          </wsHttpBinding>
    I would like to use "Membership Provider" for authentication like this:
    Code:
          <membership defaultProvider="MySqlMembershipProvider">
            <providers>
              <clear/>
              <add name="MySqlMembershipProvider"
                   connectionStringName="MyLocalSQLServer"
                   applicationName="IspUtil"
                   type="System.Web.Security.SqlMembershipProvider"
                   enablePasswordRetrieval="false"
                   enablePasswordReset="false"
                   requiresQuestionAndAnswer="false"
                   requiresUniqueEmail="true"
                   passwordFormat="Hashed" />
            </providers>
          </membership>
    The service Behavior configuration is set like the following:
    Code:
              <serviceCredentials>
                <serviceCertificate findValue="CN=RezaCert" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectDistinguishedName" />
                <userNameAuthentication userNamePasswordValidationMode="MembershipProvider" membershipProviderName="MySqlMembershipProvider" />
              </serviceCredentials>
    I created my certificate under common name of "RezeCert". Everything is fine as far as the client and server is on the same machine. But when I try to deploy it on separate client and server machines, the following exception raises:

    An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.

    Inner Exception is
    An error occurred when verifying security for the message.


    Any reply to the following questions will be appreciated:
    1. Why do I get the exception above?
    2. Is it possible to run it in real environment without obtaining a valid certificate (using my test certificate)?
    3. Should I set any specific configuration in IIS --> Security tab?
    Last edited by Hack; 01-20-2009 at 12:57 PM. Reason: Fixed Code Tags

Similar Threads

  1. Custom Membership Provider
    By hermiod in forum ASP.NET
    Replies: 0
    Last Post: 10-12-2007, 09:37 AM
  2. Custom Membership Provider
    By asafb in forum ASP.NET
    Replies: 1
    Last Post: 11-21-2005, 01:21 PM
  3. Replies: 0
    Last Post: 07-15-2001, 01:39 PM
  4. Replies: 0
    Last Post: 04-10-2000, 11:26 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center