Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

401.1 Error when accessing virtual directory pointing to network share

IIS5 is running on SERVER1.

One of the virtual directories in IIS, myfiles, is pointing to "A shared location on another computer", //SERVER2/myfilesshare

When I try to access the page: http://SERVER1/myfiles

... I get the error:

You are not authorized to view this page

HTTP 401.1 - Unauthorized: Logon Failed

Internet Information Services

I have triple-checked the "Connect As..." settings in IIS. The credentials I'm using to access the share are correct-- they work when connect to the share in Windows Explorer, but not through the IIS virtual directory. I've tried granting full permission to Everyone on the folder in SERVER2, but no luck.

Any thoughts?

like image 579
frankadelic Avatar asked Dec 23 '22 12:12

frankadelic


2 Answers

This was how I solved my problem, might help you.

By default, IIS uses local user called IUSR for virtual directories when using anonymous authentication. It does not use application identity, which should be obvious, if you use procmon.

How can you force it to use application identity?

Easy, under IIS manager:

1) go to Authentication

2) Edit "Anonymous authentication"

3) Select "Application pool identity"

4) Restart IIS & it should work.

The same accomplished with PS: Set-WebConfigurationProperty -filter /system.WebServer/security/authentication/AnonymousAuthentication -name username -value ""

This link contains the pros/cons: http://blogs.technet.com/b/tristank/archive/2011/12/22/iusr-vs-application-pool-identity-why-use-either.aspx

like image 168
Erti-Chris Eelmaa Avatar answered Dec 26 '22 07:12

Erti-Chris Eelmaa


Permission issues can be tricky. Try running filemon on the 'other computer' It can be downloaded over here: http://technet.microsoft.com/en-us/sysinternals/bb896642.aspx (it's not a big application just a tiny lightweight tool)

After you've started filemon, stop the monitor process (I believe it's turned on by default when you start the application), clear the logged data, create a filter for the folder you have trouble getting access to. Start the monitor process. Request your webpage. Stop the monitor process and look for "access denied" messages in filemon. When found, filemon will also mention the name of the actual user which is trying to get access. This might help you to get to a solution.

Btw when using Windows Server 2008 you will need processmon instead: http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx

like image 22
Roel Snetselaar Avatar answered Dec 26 '22 06:12

Roel Snetselaar