UserNamePasswordValidator可以工作,但不会命中断点

时间:2013-10-02 01:40:45

标签: wcf breakpoints

我已将UserNamePasswordValidator类添加到我的WCF服务中。它似乎工作正常。当我提供错误的凭据时,FaultException和自定义错误消息按预期显示。并且它通过正确的凭证而没有例外。

我的问题是我无法点击Validate方法中的断点。我可以在项目的其他地方点击断点。

有什么建议吗?测试代码如下:

using System.IdentityModel.Selectors;
using System.ServiceModel;

namespace WcfTestService1
{
    public class Service1Authenticator : UserNamePasswordValidator
    {
        public override void Validate(string userName, string password)
        {
            if (!(userName == "testUser" && password == "testPassword"))
            {
                //Specific Exception
                //throw new SecurityTokenException("Invalid Username or Password");

                //Or Specific Message
                throw new FaultException("Custom message to prove this works");
            }
        }
    }
}

0 个答案:

没有答案
相关问题