您需要在配置中定义一个行为,例如:
<behaviors>
<serviceBehaviors>
<behavior name="Framework.Services.FrameworkBehaviour">
...
<serviceAuthorization principalPermissionMode="UseAspNetRoles" roleProviderName="CustomProvider" />
<serviceCredentials>
<serviceCertificate ... />
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="...." />
</serviceCredentials>
</behavior>
这是绑定片段:
<binding name="userNamePassOverSsl" ...>
<security mode="TransportWithMessageCredential">
<transport />
<message clientCredentialType="UserName" />
</security>
</binding>