An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode
The 2nd option is the one you want.
In your web.config
, make sure these keys exist:
<configuration>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
</configuration>
Adding <validation validateIntegratedModeConfiguration="false"/>
addresses the symptom, but is not appropriate for all circumstances. Having ran around this issue a few times, I hope to help others not only overcome the problem but understand it. (Which becomes more and more important as IIS 6 fades into myth and rumor.)
Background:
This issue and the confusion surrounding it started with the introduction of ASP.NET 2.0 and IIS 7. IIS 6 had and continues to have only one pipeline mode, and it is equivalent to what IIS 7+ calls "Classic" mode. The second, newer, and recommended pipeline mode for all applications running on IIS 7+ is called "Integrated" mode.
So, what's the difference? The key difference is how ASP.NET interacts with IIS.
Classic mode is limited to an ASP.NET pipeline that cannot interact with the IIS pipeline. Essentially a request comes in and if IIS 6/Classic has been told, through server configuration, that ASP.NET can handle it then IIS hands off the request to ASP.NET and moves on. The significance of this can be gleaned from an example. If I were to authorize access to static image files, I would not be able to do it with an ASP.NET module because the IIS 6 pipeline will handle those requests itself and ASP.NET will never see those requests because they were never handed off.* On the other hand, authorizing which users can access a .ASPX page such as a request for Foo.aspx is trivial even in IIS 6/Classic because IIS always hands those requests off to the ASP.NET pipeline. In Classic mode ASP.NET does not know what it hasn't been told and there is a lot that IIS 6/Classic may not be telling it.
Integrated mode is recommended because ASP.NET handlers and modules can interact directly with the IIS pipeline. No longer does the IIS pipeline simply hand off the request to the ASP.NET pipeline, now it allows ASP.NET code to hook directly into the IIS pipeline and all the requests that hit it. This means that an ASP.NET module can not only observe requests to static image files, but can intercept those requests and take action by denying access, logging the request, etc.
Overcoming the error:
- If you are running an older application that was originally built for IIS 6, perhaps you moved it to a new server, there may be absolutely nothing wrong with running the application pool of that application in Classic mode. Go ahead you don't have to feel bad.
Then again maybe you are giving your application a face-lift or it was chugging along just fine until you installed a 3rd party library via NuGet, manually, or by some other means. In that case it is entirely possible
httpHandlers
orhttpModules
have been added tosystem.web
. The outcome is the error that you are seeing becausevalidateIntegratedModeConfiguration
defaultstrue
. Now you have two choices:- Remove the
httpHandlers
andhttpModules
elements fromsystem.web
. There are a couple possible outcomes from this:- Everything works fine, a common outcome;
- Your application continues to complain, there may be a web.config in a parent folder you are inheriting from, consider cleaning up that web.config too;
- You grow tired of removing the
httpHandlers
andhttpModules
that NuGet packages keep adding tosystem.web
, hey do what you need to.
- Remove the
- If those options do not work or are more trouble than it is worth then I'm not going to tell you that you can't set
validateIntegratedModeConfiguration
tofalse
, but at least you know what you're doing and why it matters.
Good reads:
- ASP.NET 2.0 Breaking Changes on IIS 7.0
- ASP.NET Integration with IIS 7
- HTTP Handlers and HTTP Modules Overview
*Of course there are ways to get all kind of strange things into the ASP.NET pipeline from IIS 6/Classic via incantations like wildcard mappings, if you like that sort of thing.
If you still need to use the HTTP Module you need to configure it (.NET 4.0 framework) as follows:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="MyModule" type="[Namespace].[Class], [assembly]"/>
</modules>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>