401.1 Error when accessing virtual directory pointing to network share

frankadelic picture frankadelic · Mar 6, 2009 · Viewed 9.8k times · Source

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?

Answer

Erti-Chris Eelmaa picture Erti-Chris Eelmaa · Apr 21, 2015

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