Preventing Anonymous Access

How do I prevent clients from accessing my service anonymously? I’ve changed the settings in IIS from Anonymous Access to Integrated Windows Authentication. However, now I’m getting the error message: “Security settings for this service require ‘Anonymous’ Authentication but it is not enabled for the IIS application that hosts this service.”

Disabling anonymous access requires coordinating the settings in IIS and in your service configuration. Those two sources must be in agreement about whether anonymous access is expected. IIS is already using Windows authentication in this case, so let’s look at what needs to happen to the service configuration file. I’m assuming that this is IIS6 so the only network transport we’re talking about here is HTTP.

There are two cases depending on whether you want the protocol that gets exposed to be HTTP or HTTPS. The simplest is to keep using HTTP since that’s probably what you were using if anonymous access was allowed in the past. To switch off anonymous access with HTTP, you need to set the security mode to TransportCredentialOnly.

<security mode=”TransportCredentialOnly”>
<transport clientCredentialType=”Windows” />

Note that TransportCredentialOnly is not supported for every binding (in this case we’re using BasicHttp). For WSHttp, the only choice is going to be to use HTTPS. To switch off anonymous access with HTTPS, you need to set the security mode to Transport.

<security mode=”Transport”>
<transport clientCredentialType=”Windows” />

Other bindings can be made to work in this situation as well, including custom bindings. I’m just showing you the most common examples. The key in both cases though is that we’re getting transport security with the right kind of credentials associated.

Next time: Writing Binding Element Essentials

Comments (5)

  1. I’ve created a custom implementation of GetProperty for my binding but now I’m getting errors when I

  2. Amit Andhale says:


    Can we provide claim based security for SQL Server 2005 Reporting Services?



  3. How do I enable Kerberos authentication for my web service? Kerberos is a very good authentication protocol

  4. Al Pascual says:

    The web is great for learning patterns and practices when you are planning to deploy a solution. With Silverlight learning how to configure IIS for best results in a very secured environment is&#160; a huge task, what happens if you just configure IIS

  5. The web is great for learning patterns and practices when you are planning to deploy a solution. With