I am running SharePoint Server 2016 with two servers: an application and database server. I have created a new web application and site collection (URL is http://mysite.local/sites/site1) in SharePoint Central Administration under Manage web applications->New Web Application. Visiting this URL in the browser prompts for a username and password. However, even after entering a valid domain account, the login prompt continues to prompt for credentials, after which a 401 unauthorized message is shown.
Below are some of the web app settings I added, related to the authentication:
- Host header: mysite.local
- Port: 80
- Allow Anonymous: No
- Enable Windows Authentication: Yes
- Integrated Windows authentication (NTLM): Yes
- Basic authentication: Yes
- Enable Forms Based Authentication: No
- URL: http://mysite.local:80
I have added a mapping of the SharePoint server's IP address to mysite.local in the SharePoint server's hosts file for testing purposes. I have also added my domain account as an admin of the site collection.
I have also found the below error messages related to authentication in IIS manager under Sites-> My SharePoint Site -> Authentication:
"Challenge-based and login redirect-based authentication cannot be used simultaneously"
"Your applications might fail due to your current authentication settings"
I am not sure why I am experiencing the above errors since I created the web app in SharePoint and did not make any changes in IIS manager.
SharePoint error logs:
I have checked the trace logs under the following path:
%CommonProgramFiles%\Microsoft Shared\Web Server Extensions\16\LOGS\
and found some more info regarding the 401 unauthorized message:
Claims Windows Sign-In: Sending 401 for request ' http://mysite.local/sites/site1' because the user is not authenticated and resource requires authentication.
Alternate Access Mappings:
An entry has automatically been added for AAM:
Regarding if accessing SharePoint site worked before adding host header:
I did not try to add web app in SharePoint on port 80 without a host header, since I have another site in IIS running on port 80. However, I did try adding a web app in SharePoint on a different port (port 81) without a host header e.g. http://192.168.137.1:81 and authenticating to this site worked successfully.