Add Service Reference, Multiple Credential Prompt

Dave Ziegler picture Dave Ziegler · Jan 9, 2012 · Viewed 20.3k times · Source

I started a new blank console app project in VS (I am using VS2010), and choose Add Service Reference to a web service protected with a username and password.

When I click Go in the dialog box, I'm confronted with a Yes/No prompt to accept a certificate. I choose Yes, then I arrive at a Discovery Credential prompt asking for User Name and Password.

If I key those in correctly several times (3+), I finally gain access to the WSDL. Or, oddly enough if I key them correctly once, then cancel, then go through the process again, my creds are accepted on the first attempt.

I asked The Googles and found a few instances related to SQL reporting web services, and someone posted here about something similar, but no one seems to have a definitive answer.

Can anyone explain this odd behavior? Is the service configured incorrectly or is this some sort of known issue with web services or WCF services?

Answer

Dave Ziegler picture Dave Ziegler · Jan 9, 2012

I'm not sure if this is the answer yet or not, but I'm posting this in case it helps someone else.

From what I have seen, if you get into a continuous username+password prompt problem when adding a web reference or service reference to a secure web service and you are certain you are entering the credentials correctly, make sure you try two things:

1) Use domain\username vs. username only

2) After you enter your credentials at least once correctly and you are prompted a second time, DON'T DO ANYTHING FURTHER for 30-60 seconds (I just made that up, YMMV). If you wait on the prompt and then click Cancel, the service reference may be sitting there waiting for you to add to the project.

From what I am seeing, Visual Studio gets in a hurry and re-prompts you before it has time to download the WSDL and/or generate proxy classes.