Unable to debug WCF service in VS2008 after UserNamePasswordValidator fault

Posted by lsb on Stack Overflow See other posts from Stack Overflow or by lsb
Published on 2009-07-20T15:04:04Z Indexed on 2010/04/19 6:13 UTC
Read the original article Hit count: 1010

Filed under:
|

Hi! I have a WCF service that I secure with a custom UserNamePasswordValidator and Message security running over wsHttpBinding. The release code works great. Unfortunately, when I try to run in debug mode after having previously used invalid credentials (the current credentials ARE valid!) VS2008 displays an annoying dialog box (more on this below).

A simplified version of my Validate method from the validator might look like the following:

    public override void Validate(string userName, string password)
    {
        if (password != "ABC123")
            throw new FaultException("The password is invalid!");
    }

The client receives a MessageSecurityException with InnerException set to the FaultException I explictly threw. This is workable since my client can display the message text of the original FaultException I wanted the user to see.

Unfortunately, in all subsequent service calls VS2008 displays an "Unable to automatically debug..." dialog. The only way I can stop this from happening is to exit VS2008, get back in and connect to my service using correct credentials. I should also add that this occurs even when I create a brand new proxy on each and every call. There's no chance MY channel is faulted when I make a call. Its likely, however, that VS2008 hangs on to the previously faulted channel and tries to use it for debugging purposes.

Needless to say, this sucks! The entire reason I'm entering "bad" credentials is to test the "bad-credential" handling.

Anyway, if anyone has any ideas as to how I can get around this bug (?!?) I'd be very very appreciative....

© Stack Overflow or respective owner

Related posts about wcf

Related posts about c#