Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

After upgrading to .Net 4.0, you are unable to debug a WCF service hosted on IIS 6


Symptoms

You have a WCF service application hosted on IIS 6 with the following settings:
  • This is a Web Site Project,
  • The WCF service uses webHttpBinding,
  • On IIS, both NTLM authentication and Anonymous authentication are enabled.

After upgrading to .Net 4.0, you may not be able to debug your WCF service application on IIS 6 with the following exception:

System.ServiceModel.ServiceActivationException: The service '/*' cannot be activated due to an exception during compilation.  The exception message is: 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.

↑ Back to the top


Cause

This is by design. Anonymous + Windows authentication is not supported by WebServiceHost in IIS with .Net 4.0.

However, Visual Studio 2010 requires Windows authentication to debug a Web Site Project.

↑ Back to the top


Resolution

  1. Create a new .aspx page under the root folder of your WCF application, for example, start.aspx
  2. Replace the content of this page with the following information:
    <html>
    <a href="default.aspx">Click to debug the default page</a>
    </html>
  3. Open IIS MMC, and set the authentication of the application to Anonymous only.
    1. At a command prompt, type runas /user:Administrative_AccountName "mmc %systemroot%\system32\inetsrv\iis.msc".
    2. In IIS Manager, double-click the local computer; localte to the application folder; right click and then click Properties.
    3. Click the Directory Security, and then, in the Authentication and access control section, click Edit.
    4. Select the Enable anonymous access check box.
    5. Click OK twice.
  4. Open IIS MMC, and set the authentication of start.aspx to Windows Authentication only.
    1. At a command prompt, type runas /user:Administrative_AccountName "mmc %systemroot%\system32\inetsrv\iis.msc".
    2. In IIS Manager, double-click the local computer; localte to the start.aspx file; right click and then click Properties.
    3. Click the File Security, and then, in the Authentication and access control section, click Edit.
    4. Select the Windows Integrated Authentication check box, and un-select Enable anonymous access check box.
    5. Click OK twice.
  5. In Visual Studio 2010, set start.aspx as the start page.
  6. Now, press F5 in Visual Studio 2010 to start debugging the WCF service application.

↑ Back to the top


More Information

.NET 4.5 has added the feature to support Anonymous + Windows authentication when using webHttpBinding. 

In addition to upgrading to .Net 4.5, you can consider using the Web Application Project.


↑ Back to the top


Keywords: kb

↑ Back to the top

Article Info
Article ID : 2659988
Revision : 1
Created on : 1/7/2017
Published on : 4/5/2012
Exists online : False
Views : 108