解决方法@H_403_4@
基本上任何接受用户名/密码作为消息安全性的客户端凭据的绑定都可以配置为使用ASP.NET成员身份提供程序。
查看这个MSDN文档在how to use the ASP.NET Membership provider in WCF – 您需要配置您的绑定的客户端凭据类型“UserName”
<bindings>
<wsHttpBinding>
<!-- Set up a binding that uses UserName as the client credential type -->
<binding name="MembershipBinding">
<security mode ="Message">
<message clientCredentialType ="UserName"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
以及使用ASP.NET成员身份进行用户身份验证的服务:
<serviceBehaviors>
<behavior name="AspNetMembership">
<serviceCredentials>
<userNameAuthentication
userNamePasswordValidationMode ="MembershipProvider"
membershipProviderName ="sqlMembershipProvider"/>
</serviceCredentials>
</behavior>
</serviceBehaviors>
当然,您必须在配置它们时将此服务行为应用于您的服务!
<services>
<service name="YourService" behaviorConfiguration="AspNetMembership">
....
</service>
</services>
userName客户端凭证类型由basicHttpBinding,wsHttpBinding,netTcpBinding支持,几乎是所有常见的嫌疑人。
查看这个MSDN文档在how to use the ASP.NET Membership provider in WCF – 您需要配置您的绑定的客户端凭据类型“UserName”
<bindings> <wsHttpBinding> <!-- Set up a binding that uses UserName as the client credential type --> <binding name="MembershipBinding"> <security mode ="Message"> <message clientCredentialType ="UserName"/> </security> </binding> </wsHttpBinding> </bindings>
以及使用ASP.NET成员身份进行用户身份验证的服务:
<serviceBehaviors> <behavior name="AspNetMembership"> <serviceCredentials> <userNameAuthentication userNamePasswordValidationMode ="MembershipProvider" membershipProviderName ="sqlMembershipProvider"/> </serviceCredentials> </behavior> </serviceBehaviors>
当然,您必须在配置它们时将此服务行为应用于您的服务!
<services> <service name="YourService" behaviorConfiguration="AspNetMembership"> .... </service> </services>
userName客户端凭证类型由basicHttpBinding,wsHttpBinding,netTcpBinding支持,几乎是所有常见的嫌疑人。