Debug WCF service IIS specified authentication schemes 'IntegratedWindowsAuthentication, Anonymous', but the binding only supports

If you want to debug a WCF service you may encounter the following error in Visual Studio:

IIS specified authentication schemes 'IntegratedWindowsAuthentication, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings so that only a single authentication scheme is used.. ---> System.InvalidOperationException: IIS specified authentication schemes 'IntegratedWindowsAuthentication, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings so that only a single authentication scheme is used

This can occur if the virtual directory hosting the service in IIS has both the Intergrated Windows Authentication and Anonymous authentication schemes selected.  In order to get around this so that you can debug your service, you can do the following:

  1. In IIS, uncheck the Annonymous scheme
  2. In IIS, leave Integrated Windows Authentication checked - this is required to run the VS Debugger
  3. Start the debugger from VS
  4. Before you make a request to your service, go back into IIS and check the Annonymous scheme
  5. Make a request to your service and your break point will be hit

Add comment