MVC 1 and IIS 7 error code 4011
I've got an MVC 1 application running on IIS 7.5. After some operations are complete, I've got a RedirectToRoute call using System.Web.Routing.RouteValueDictionary as the second parameter. Basically it call开发者_运维问答s for "Details" of the particular object by ID.
When this code is encountered on my production server running IIS 7.5, it takes me back to the login page and has a ReturnUrl value in the URL at the top. Once I log in again, it takes me to the page that it was supposed to take me directly to with RedirectToRoute.
It does not do this on localhost. The details in the event log are:
Event code: 4011
Event message: An unhandled exception has occurred ... Application domain: -domain- Trust level: Full Application path: c:\inetpub\wwwroot\ ... Request URL: http://mysite.com/405/Acquisition Request path: /properties/405/Acquisition User host address: -my external ip- User: -logged in user- Is authenticated: True Authentication Type: Forms Thread account name: NT AUTHORITY\NETWORK SERVICE
Now of course that path does not exist physically on the server, hence the use of MVC. So I'm guessing its some sort of permissions thing with IIS7? Especially because it goes to the correct page (and displays the confirmation message) when I log in again. Isn't that what Event Code 4011 is?
Any help is appreciated.
EDIT:
Per Phill's question, here is that piece of the web.config:
<modules runAllManagedModulesForAllRequests="true">
<remove name="ScriptModule" />
<remove name="UrlRoutingModule" />
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</modules>
It's almost certainly a permissions issue, but probably not an IIS permissions issue.
The functionality to redirect to the login page is an ASP .NET feature, which is configured in your Web.config file. It looks like you're using Forms authentication, so it'd be under:
<configuration>
<system.web>
<authentication mode="Forms">
<forms loginurl="~/some-login-url">
</authentication>
</system.web>
</configuration>
Are you using any [Authorize] attributes (I'm not sure if those even exist in MVC 1)? Do you have any authorization entires in your Web.config?
Does the first page display without requiring you to log in, and it's only when you are going to the second page that it's prompting you to log in?
Another common problem that I've seen has to do with the App Pool recycling. I had an app once that would do a lot of work, store a lot of information in the user's session, and then the user would get sent to a sign-in page. I eventually figured out that the app was hitting its memory limits in IIS, causing it to recycle. Consequently, the user would be prompted to sign in again.
I'm not sure if you might be having that exact problem, but have you looked at the Application Pool settings to verify that the app wouldn't be recycling? You might also want to make sure that you don't have any other really heavy applications in the same app pool that could also be recycling.
Try <identity impersonate="false" />
in web.config
精彩评论