简体   繁体   中英

Unable to debug WCF service in VS2008 after UserNamePasswordValidator fault

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....

I'm starting to think that the problem has to do with proxy closure. I just saw an excellent set of WCF video's from Michele Leroux Bustamante ( http://wcfguidanceforwpf.codeplex.com ) that makes me think the problem may be in my client code. I'll give it a go today and report back how it did....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM