401 Unauthorized: Access is denied due to invalid credentials
Solution 1:
I realize this is an older post but I had the same error on IIS 8.5. Hopefully this can help another experiencing the same issue (I didn't see my issue outlined in other questions with a similar title).
Everything seemed set up correctly with the Application Pool Identity, but I continued to receive the error. After much digging, there is a setting for the anonymous user to use the credentials of the application pool identity or a specific user. For whatever reason, mine was defaulted to a specific user. Altering the setting to the App Pool Identity fixed the issue for me.
- IIS Manager → Sites → Website
- Double click "Authentication"
- Select Anonymous Authentication
- From the Actions panel, select Edit
- Select Application pool Identity and click ok
Hopefully this saves someone else some time!
Solution 2:
If you're using IIS 7 do something like this:
- Select your site.
- Click on error pages.
- Edit feature settings.
- Select detailed errors.
Solution 3:
Make sure that you enabled anonymous authentication on iis like this:
Solution 4:
In case anyone is still looking for this, this solved the problem for us:
To whoever this may help, this saved my life...
IIS 7 was difficult for figuring out why i was getting the 401 - Unauthorized: Access is denied due to invalid credentials... until i did this...
- Open IIS and select the website that is causing the 401
- Open the "Authentication" property under the "IIS" header
- Click the "Windows Authentication" item and click "Providers"
- For me the issue was that Negotiate was above NTLM. I assume that there was some kind of handshake going on behind the scenes, but i was never really authenticated. I moved the NTLM to the top most spot, and BAM that fixed it.
Here is the link where this was found.
Solution 5:
I realize its an old question, but this came up in my searches. Had a similar issue for an MVC application recently built, deployed for the first time, and Authentication mechanism wasn't completely hashed out.
It wasn't an IIS setting in my case, it was a Controller that was not [AllowAnonymous]
decorated. I was using a Render.Action/Html.Action in a Layout.cshtml and the User was unauthenticated. So the Layout tried to load an Authenticated Action in an UnAuthenticated context.
Once I updated the action to AllowAnonymous, the problem went away, and this is what led me to it.
Hope this helps someone.