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:
- In IIS, uncheck the Annonymous scheme
- In IIS, leave Integrated Windows Authentication checked - this is required to run the VS Debugger
- Start the debugger from VS
- Before you make a request to your service, go back into IIS and check the Annonymous scheme
- Make a request to your service and your break point will be hit
We were gettign an error with one of our WCF services "System.ServiceModel.CommunicationException: An error occurred while receiving the HTTP response to..." and needed to get additional information on the problem. Below are steps to use the built in diagnostics with WCF to find out more info for the error above as well as the overall health of your service.
- Add to your web.config:
- Create the necessary folder and ensure the security is set so IIS/ASP.NET can write to the log file
- Use the SvcTraceViewer.exe application to view your log file
This tool can be found in the SDK directory...for me, this was C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin
Recently I had a WCF service call that was returning the error System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (400) Bad Request.
Looking into this, I discivered that the messages we were sending were increasing in size. We were using the basic http binding and it turns out the default readerQuotas were too small and were causing the"Bad Request" error.
I increased the readerQuotas to the values below and that resolved the error.
<readerQuotas maxDepth="2000000" maxStringContentLength="2000000" maxArrayLength="2000000"
maxBytesPerRead="2000000" maxNameTableCharCount="2000000" />