Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unauthorized access error to html pages in IIS 7.0

I am using VSTS 2008 + C# + .Net 3.5 + IIS 7.0. I have created a new web site and put an html file into the directory. And when I use browse function in IIS manager to browse the html file, I met with the following error, any ideas what is wrong?

BTW: I am very confused about unauthorized error since I run the worker process under administrator account. From the error message, I am confused why the logon method is anonymous and not using administrator account?

HTTP Error 401.3 - Unauthorized
You do not have permission to view this directory or page because of the access control list (ACL) configuration or encryption settings for this resource on the Web server.

Module IIS Web Core 
Notification AuthenticateRequest 
Handler StaticFile 
Error Cde 0x80070005 
Requested URL http://localhost:80/a.html 
Physical Path C:\test\simplehosttest\a.html 
Logon Method Anonymous 
Logon User Anonymous 
like image 529
George2 Avatar asked Dec 13 '09 10:12

George2


3 Answers

C:\test\simplehosttest\a.html

Please grant IUSR account necessary rights on this file or its folder. Then 401.3 error will disappear.

like image 50
Lex Li Avatar answered Nov 03 '22 09:11

Lex Li


In IIS 8.5 (fresh install) I had my application pool run as a custom identity and the files stored in a folder outside /inetpub/wwwroot. The identity had all the proper file privileges, but still I got an acl error.

After some struggles I found out that in IIS manager->My Site->Authentication->Anonymous Authentication->Edit the identity used for anonymous authentication was set to a specific user by default (IUSR). Setting it to use the application pool identity fixed it for me!

like image 32
Matthijs Bos Avatar answered Nov 03 '22 11:11

Matthijs Bos


Basically you have to grant read access to the file to the identity that runs your apppool in IIS. On 2008 server and Vista that identity (unless you have explicitly changed it) would be "NT Authority\Network Service" and on windows7 it's "IisAppPool\AppPoolIdentity" (and don't ask why they have done that on win7, it's a WTF if you ask me)

like image 1
Klaus Byskov Pedersen Avatar answered Nov 03 '22 09:11

Klaus Byskov Pedersen