Unable to debug WCF service in VS2008 after UserNamePasswordValidator fault
- by lsb
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....