Microsoft Knowledge Base Email Alertz

(871179) - Explains that you may receive an error message when you try to access a Web site that is configured to use Integrated Windows authentication only.

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 871179 - Last Review: April 30, 2008 - Revision: 5.1

You receive an "HTTP Error 401.1 - Unauthorized: Access is denied due to invalid credentials" error message when you try to access a Web site that is part of an IIS 6.0 application pool

On This Page

SYMPTOMS

When you try to access a Microsoft Internet Information Services (IIS) 6.0 Web site that is configured to use Integrated Windows authentication only, you are prompted for your user credentials. When you try to log on, you receive the logon prompt again. After you try to log on three times, you receive the following error message:
HTTP Error 401.1 - Unauthorized: Access is denied due to invalid credentials.

CAUSE

This behavior may occur if the following conditions are true:
  • The IIS 6.0 Web site is part of an IIS application pool.
  • The application pool is running under a local account or under a domain user account.
  • The Web site is configured to use Integrated Windows authentication only.
In this scenario, when Integrated Windows authentication tries to use Kerberos, Kerberos authentication may not work. To use Kerberos authentication, a service must register its service principal name (SPN) under the account in the Active Directory directory service that the service is running under. By default, Active Directory registers the network basic input/output system (NetBIOS) computer name. Active Directory also permits the Network Service or the Local System account to use Kerberos.

RESOLUTION

If this behavior occurs when the application pool is running under a local account, follow the steps in the "Workaround" section.

To resolve this behavior when the application pool is running under a domain user account, set up an HTTP SPN with the NetBIOS name and the fully qualified domain name (FQDN) of the domain user account that the application pool is running under. To do this, follow these steps on a domain controller:

Important An SPN for a service can only be associated with one account. Therefore, if you use this suggested resolution, any other application pool that is running under a different domain user account cannot be used with Integrated Windows authentication only.
  1. Install the Setspn.exe tool. To obtain the Microsoft Windows 2000 version of the tool, visit the following Microsoft Web site:
    http://www.microsoft.com/downloads/details.aspx?FamilyID=5fd831fd-ab77-46a3-9cfe-ff01d29e5c46&displaylang=en (http://www.microsoft.com/downloads/details.aspx?FamilyID=5fd831fd-ab77-46a3-9cfe-ff01d29e5c46&displaylang=en)
    To obtain the Setspn.exe tool for Microsoft Windows Server 2003, click the following article number to view the article in the Microsoft Knowledge Base:
    970536  (http://kbalertz.com/Feedback.aspx?kbNumber=970536/ ) Setspn.exe support tool update for Windows Server 2003
  2. Start a command prompt, and then change to the directory where you installed Setspn.exe.
  3. At the command prompt, type the following commands. Press ENTER after each command:
    setspn.exe -S http/IIS_computer's_NetBIOS_name DomainName\UserName

    setspn.exe -S http/IIS_computer's_FQDN DomainName\UserName
    Note UserName is the user account that the application pool is running under. Also note that if you are running the setspn.exe command on a Windows 2000 machine, use the -A switch instead of the -S switch.
After you set the SPN for the HTTP service to the domain user account that the application pool is running under, you can successfully connect to the Web site without being prompted for your user credentials.

WORKAROUND

To work around this behavior if you have multiple application pools that run under different domain user accounts, you must force IIS to use NTLM as your authentication mechanism if you want to use Integrated Windows authentication only. To do this, follow these steps on the server that is running IIS:
  1. Start a command prompt.
  2. Locate and then change to the directory that contains the Adsutil.vbs file. By default, this directory is C:\Inetpub\Adminscripts.
  3. Type the following command, and then press ENTER:
    cscript adsutil.vbs set w3svc/NTAuthenticationProviders "NTLM"
  4. To verify that the NtAuthenticationProviders metabase property is set to NTLM, type the following command, and then press ENTER:
    cscript adsutil.vbs get w3svc/NTAuthenticationProviders
    The following text should be returned:
    NTAuthenticationProviders       : (STRING) "NTLM"

STATUS

This behavior is by design.

MORE INFORMATION

If you set the SPN by using only the FQDN of the server that is running IIS, you will be prompted for your user credentials after 30 minutes. The 30-minute time-out occurs because of the way that Internet Explorer caches Domain Name System (DNS) information. After 30 minutes, Internet Explorer reverts to the NetBIOS name. Therefore, you must make sure that you also register the SPN by using the NetBIOS name of the server that is running IIS to avoid being prompted for your user credentials. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
263558  (http://kbalertz.com/Feedback.aspx?kbNumber=263558/ ) How Internet Explorer uses the cache for DNS host entries
To verify the registered SPNs for the user account that your application pool is running under, start a command prompt, type the following command from the directory where Setspn.exe is installed, and then press ENTER:
setspn.exe -l UserName
A list of the registered SPNs for the user account is returned.

Internet Information Services (IIS) 7.0

The topics discussed in this article can also apply to IIS 7.0 if one of the following conditions is true:
  • Kernel Mode Authentication is disabled.
  • Kernel Mode Authentication is enabled, and the useAppPoolCredentials attribute is set to TRUE.

REFERENCES

For additional information about using Integrated Windows authentication with IIS application pools, visit the "Worker Process Identity Restrictions with Kerberos" section of the following Microsoft Web site:
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/523ae943-5e6a-4200-9103-9808baa00157.mspx (http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/523ae943-5e6a-4200-9103-9808baa00157.mspx)
For additional information about authentication failures or access control failures in IIS, you can download Authentication and Access Control Diagnostics 1.0. The following file is available for download from the Microsoft Download Center:
http://www.microsoft.com/downloads/details.aspx?FamilyId=E90FE777-4A21-4066-BD22-B931F7572E9A&displaylang=en (http://www.microsoft.com/downloads/details.aspx?FamilyId=E90FE777-4A21-4066-BD22-B931F7572E9A&displaylang=en)
Note The AuthDiag tool is designed to help you when you see either of the following error messages:
  • 401.1 logon failed
  • 401.3 ACL
The AuthDiag tool can also help you when you experience Kerberos problems.

APPLIES TO
  • Microsoft Internet Information Services 6.0
  • Microsoft Internet Information Services 7.0
Keywords: 
kbtshoot kbprb KB871179
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Benjamin Osahon - bosahon NOSPAM-AT-NOSPAM gts-infotel.com Report As Irrelevant  
Written: 3/1/2006 6:30 AM
I upgraded from windows2000 server to 2003 server, after which when I try to access my web service it prompt for credentials. The system is a standalone server so I tried the workround you described above, to change the authentication mechanism to NTLM, but with NO success. The problem persisted. What else should I do?