Tuesday, November 30, 2010

How To Use Impersonation in ASP.NET Configuration With IIS 7.5 And Integrated Pipeline

While working on a few applications that have Impersonation="True" in my ASP.NET configuration, I ran into the following error upon deployment to an IIS 7.0 or 7.5 server:

"HTTP Error 500.24 - Internal Server Error An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode"

This is essentially a 'flag' warning that is raised when using Impersonation in your web.config and deploying to an IIS 7.0+ server using an Application Pool with Integrated Pipeline. If this configuration was mistakenly added, you can remove the configuration or set it to 'False' to fix the problem. There are (2) solutions for those that do need Impersonation="True".

1. Switch the Application Pool on IIS to use a 'Classic' Pipeline.
2. Add the following configuration to your web.config under the <system.webserver> section:

<system.webServer>
<!--When using 'Integrated Pipeline' on IIS on the server, and if your application does not rely on impersonating the requesting user in the 'BeginRequest' and 'AuthenticateRequest' stages (the only stages where impersonation is not possible in Integrated mode), but still requires Impersonation in other areas of the application, ignore this error (500 - Internal Server Error) by adding the following to your application’s web.config-->
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>

I actually used the explanation from the following helpful IIS Blog link (here) to create the XML comment above the configuration, and I reccomend reading it for a more in depth explination direct from an IIS Program Manager.

2 comments:

  1. Thanks. Finally a clear underatanding of what was going on there.

    ReplyDelete
  2. Old thread, but was very helpful. Here's a working link to the blog article:
    https://www.iis.net/learn/application-frameworks/building-and-running-aspnet-applications/aspnet-20-breaking-changes-on-iis

    ReplyDelete