Getting 401.2 error with IIS basic authentication instead of a password prompt

http-basic-authenticationiis-7.5iis-8

When I deploy a web site locally in IIS on Windows 7 with a section in web.config allowing a single local user to authenticate, it works fine.

<authorization>
    <allow users=".\test01" />
    <deny users="*" />
</authorization>

Navigating to https://localhost:5555/testPage I get a pop-up for the credentials and entering .\test01 with its password puts me into the page.

However when deploying the same site to a WS 2012 R2 Standard in a workgroup, and only changing the user name to the local user created by the sysadmins, I do not get a login pop-up when accessing the exact same URL. Instead I get a page with 401.2 error "not authorized" in IE and below in FF:

401 – Unauthorized: Access is denied due to invalid credentials. You
do not have permission to view this directory or page using the
credentials that you supplied.

Initially the sysadmin created the user with local logon denied, but then we turned that off for troubleshooting and still got the same issue.

Commenting out the section in web.config allows me to browse the page.

If it matters, the site is running as an application both on my local and on the server.

What could be causing the authentication issue like this?

Best Answer

Just figured that in IIS 8 basic auth is not installed by default. It needs to be installed by running an elevated command-prompt or PowerShell:

dism /online /enable-feature /featurename:IIS-BasicAuthentication

as per How do I enable Basic Authentication for IIS 8 in Windows Server 2012 and then enabled in IIS manager.