IIS 7.5 and MVC 3 using Windows Authentication - Getting 401 for static content, but never get prompted for credentials
I have a MVC 3 site running on Server 2008 R2 with IIS 7.5. I am wondering why, (using fiddler), I keep开发者_StackOverflow中文版 getting 401 responses on static content followed immediately by either a 302 or a 200? Is this something I need to be concerned about? I can directly navigate in my browser to the content giving a 401, and the browser displays it without prompting for credentials.
If I do a trace on failed requests, I get this as output:
ModuleName UrlAuthorization
Notification 4
HttpStatus 401
HttpReason Unauthorized
HttpSubStatus 0
ErrorCode 0
ConfigExceptionInfo
Notification AUTHORIZE_REQUEST
ErrorCode The operation completed successfully. (0x0)
I have checked all the directories, and files and they have the application pool user, (domain user), as owner with full permissions.
As I said, my site is not broken, but I am wondering if I have an issue with my set up.
Thanks in advance.
EDIT: Here is a sample from Fiddler:
Alright ... I resolved this in an odd way. In IIS 7.5 you can set the credentials to use when accessing the physical path for the file system. It appears by default it uses a "pass through" option ... somehow this appears to not work even when IUSR has access on the file system. I made a basic user account, granted them read on the file system, and then under IIS -> my website [Right Click] -> "Manage Website" -> "Advanced Settings" and updated the Physical Path Credentials.
Oddly, Orchard, sharepoint, tfs, and SSRS websites on the same server didn't have this issue ... just my MVC3 app running from wwwroot.
Deployed a simple MVC3 app to the default web path in IIS 7.5 / Windows 2008R2 that works correctly within Vis2k10's web server. Accessing the site unauthenticated, even though I am using the [authorize] on specific modules, retained the default code in global.asax.cs, and really haven't modified much. Any suggestions would be appreciated.
Tried enabling only Anonymous as well as Anonymous plus Forms authentication without luck.
Added to web.config without success:
<location path="Content">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
Tried updating modules without success:
<modules>
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
</modules>
Verified IIS permissions with access to the file system. Once logged in, system works like a champ.
Do you have a web.config in your content folder by any chance or any auth rules setup for the content folder in your root web.config or in any application above it that could cause web config inheritance to be an issue?
精彩评论