IIS 7.5 401 - Unauthorized: Access is denied due to invalid credentials
Notes on how to set up a new ASP.Net website in Windows 7 Pro on IIS 7.5. The trick is to create a new application pool for the new site and configure the site to impersonate the same user as the application pool, which is "IIS AppPool\application-pool-name".
How to set up a site on IIS 7.5 on Windows 7 Professional
Go to Add/Remove Windows Features and enable IIS management tools and IIS Services.
Open IIS Manager and go to Application Pools and add a new application pool named "MyApp". Leave the "Identity" setting at "ApplicationPoolIdentity". Windows automatically creates a built-in account named "IIS AppPool\MyApp" with NETWORKSERVICE permissions.
Set up the website and enable Anonymous Authentication and Forms authentication.
Edit the "Anonymous Authentication" settings, and select "Application pool identity" as the "Anonymous user identity".
Go to Windows Explorer and assign Read/Execute permissions to the web site's files/folders. You will have to manually type in the name of the application pool identity! Use the folder properties Security tab to add the permissions.
In SQL Server, you will also have to add a security login for "IIS AppPool\MyApp". This is the user that will be connecting to the SQL server instance if "Integrated Security=True" in the connection string.
The above technique will help solve strange "401 - Unauthorized: Access is denied due to invalid credentials" errors.
Disclaimer: This content is provided as-is. The information may be incorrect.