401.1 Error when accessing virtual directory pointing to network share

iisnetwork-sharesharingvirtual-directory

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?

Best Answer

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

Related Topic