AspNetMembership provider with WCF service
Posted
by Sly
on Stack Overflow
See other posts from Stack Overflow
or by Sly
Published on 2010-04-07T08:22:00Z
Indexed on
2010/04/07
8:23 UTC
Read the original article
Hit count: 417
I'm trying to configure AspNetMembershipProvider to be used for authenticating in my WCF service that is using basicHttpBinding. I have following configuration:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="basicSecureBinding">
<security mode="Message"></security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="MyApp.Services.ComputersServiceBehavior">
<serviceAuthorization roleProviderName="AspNetSqlRoleProvider" principalPermissionMode="UseAspNetRoles" />
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="MembershipProvider" membershipProviderName="AspNetSqlMembershipProvider"/>
</serviceCredentials>
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MyApp.Services.ComputersServiceBehavior" name="MyApp.Services.ComputersService">
<endpoint binding="basicHttpBinding" contract="MyApp.Services.IComputersService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
Roles are enabled and membership provider is configured (its working for web site).
But authentication process is not fired at all. There is no calles to data base during request, and when I try to set following attribute on method:
[PrincipalPermission(SecurityAction.Demand, Authenticated = true)]
public bool Test()
{
return true;
}
I'm getting access denied exception. Any thoughts how to fix it?
© Stack Overflow or respective owner