Tutorial :ASP.Net Membership provider in WCF (WebHttpBinding)


I'm developping a WPF application that needs authentification. I want to use the client application services to use the ASP.Net Membership Provider (see this link if you don't know what I'm talking about). Actually, I made my own provider based on the MembershipProvider. It works perfectly with a ASP.Net projet.

But now, I don't want my authentification to be hosted in a ASP.Net projet anymore, but to be in WCF.

So, I did a WCF service and used a WebHttpBinding. Everything is ok, until the login is entered. The call is made to the service, no doubt about it, but nothing happens. In fact, it's like the call has been made but isn't served. I can confirm it because I used the service trace viewer to log all the messages to the service.

Eventually, I receive a timeout with the message :

The incoming HTTP request's URI 'http://localhost:21200/Authentication_JSON_AppService.axd/Login' does not match any service operation.

It's like if the Provider isn't taking the call or receive it. I really don't know where to look. I've done my research but I did'nt find similar examples. Here's my settings :

1. Config file for the Membership Provider (working in a ASP.NET project)

<system.web.extensions>  <scripting>    <webServices>      <authenticationService enabled="true" />      <roleService enabled="true" />    </webServices>  </scripting>  </system.web.extensions>  <system.web>    <authentication mode="Forms" />    <authorization>      <allow users="*"/>    </authorization>    <membership defaultProvider="FooMembershipProvider">      <providers>        <add name="FooMembershipProvider" type="Foo.Web.Security.FooMembershipProvider, Foo.Web" />      </providers>    </membership>  </system.web>  

2. Config file for my application, section service (working if I use the ASP.NET project)

<system.serviceModel>    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />      <behaviors>      <endpointBehaviors>        <behavior name="WebBehavior">          <webHttp />          <enableWebScript />        </behavior>      </endpointBehaviors>      <serviceBehaviors>        <behavior name="WebBehavior">          <serviceMetadata httpGetEnabled="true" httpGetUrl="" />          <serviceDebug includeExceptionDetailInFaults="true" />        </behavior>      </serviceBehaviors>    </behaviors>        <bindings>      <basicHttpBinding>        <binding name="basicHttpMode">          <security mode="None" />        </binding>      </basicHttpBinding>      <webHttpBinding>        <binding name="webHttpMode">          <security mode="None" />        </binding>      </webHttpBinding>    </bindings>      <services>      <service behaviorConfiguration="WebBehavior"             name="Foo.Security.Business.Manager.Wcf.Host.SecurityManager">          <endpoint address=""                binding="webHttpBinding"                contract="Foo.Security.Business.Contract.ISecurityContract"                behaviorConfiguration="WebBehavior"                bindingConfiguration="webHttpMode" />        <host>          <baseAddresses>            <add baseAddress="http://localhost:21200" />          </baseAddresses>        </host>      </service>    </services>  </system.serviceModel>    

3. Config file for my application, section call of the service (working if I use the ASP.NET project)

<membership defaultProvider="ClientAuthenticationMembershipProvider">     <providers>       <add name="ClientAuthenticationMembershipProvider"  type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35"           serviceUri="http://localhost:21200/Authentication_JSON_AppService.axd"           credentialsProvider="Foo.Windows.LoginWindow, Foo.Windows" />         <add name="FooMembershipProvider"           type="Foo.Security.Business.Provider.FooMembershipProvider, Foo.Security.Business"           serviceUri="http://localhost:21200/Authentication_JSON_AppService.axd"           credentialsProvider="Foo.Windows.LoginWindow, Foo.Windows" />     </providers>   </membership>   <roleManager defaultProvider="ClientRoleProvider" enabled="true">     <providers>       <add name="ClientRoleProvider"           type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35"           serviceUri="http://localhost:21200/Role_JSON_AppService.axd"           cacheTimeout="86400" />     </providers>   </roleManager>    

If anyone could give me some hints where to look, it would be appreciated. Thanks.


One thing that you could try, is to use https.

In this case you are sending a password over the network in clear text. Sometimes the technology will save you, in that if you try that it will not work.

I am not sure if this is the case here, but since it is only the login that does not work, it is worth a try.


Maybe this will help:


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »