Welcome to MSDN Blogs Sign in | Join | Help

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.

<basicHttpBinding>
<binding>
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>

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.

<wsHttpBinding>
<binding>
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
</wsHttpBinding>

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

Published Friday, March 23, 2007 5:00 AM by Nicholas Allen

Comments

Saturday, March 24, 2007 1:02 AM by Nicholas Allen's Indigo Blog

# Responding to GetProperty

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

Tuesday, March 27, 2007 9:45 AM by Amit Andhale

# re: Preventing Anonymous Access

Hi,

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

Regards

Amit

Tuesday, April 03, 2007 1:43 PM by Nicholas Allen's Indigo Blog

# Enabling Kerberos in IIS

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

New Comments to this post are disabled
 
Page view tracker