When getting an error in Windows 2008 R2, Error 401: Unauthorized: Access is denied due to invalid credentials
See – https://www.codeproject.com/Answers/418802/Unauthorized-Access-is-denied-due-to-invalid-c#answer1
Specifically Solution 6 with a minor adjustment.
Right click on the folder in Explorer and choose Properties.
In Security tab add ‘IIS_IUSRS’ and ‘NETWORK SERVICE’ and give full control to both user.
Also check Authentication. Set up the Anonymous Authentication to Application Pool Identity. Check others and disable as needed.