【发布时间】:2014-04-04 21:25:28
【问题描述】:
我有一个UserNamePasswordValidator:
public class EmployeeValidator : UserNamePasswordValidator
{
public override void Validate(String userName, String password)
{
//...
throw new MessageSecurityException("Username and password cannot be empty.");
//...
}
}
在ViewModel:
private void Login()
{
try
{
_cl.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
_cl.ClientCredentials.UserName.UserName = UserName;
_cl.ClientCredentials.UserName.Password = Password;
_cl.Login(UserName)
}
catch
{ /*...*/ }
}
问题是,我无法捕捉到异常。我做错了什么?
【问题讨论】:
-
您是否启用了 MessageSecurity?在您的绑定中配置?你在使用服务吗?
标签: c# wcf wcf-security