18

I am using IIS6, I've written an HttpModule, and I get this error? After googling the web I find that this problem is caused by the .NET framework 3.5, so I put this on a machine where I didn't install .NET 3.5, but the problem is still there!

Adam Bellaire
  • 108,003
  • 19
  • 148
  • 163
sdhjl2000
  • 257
  • 1
  • 4
  • 11

4 Answers4

39

My attempt at psychic debugging: you're using a statement like:

Response.Headers("X-Foo") = "bar"

If this is indeed the case, changing this as shown below will work around the problem:

Response.AddHeader("X-Foo", "bar")
mdb
  • 52,000
  • 11
  • 64
  • 62
  • Will `response.Headers.Location = new Uri(...);` break IIS6 and give a 500 `Internal Server Error`? – Blaise Aug 14 '13 at 19:58
7

Only IIS7 supports the integrated pipeline. On IIS7 a HttpModule can participate in all requests coming to the web server not just those targeting specific file extensions.

II6 uses what IIS7 calls the classic pipeline where a HttpModules can only get involved once the earlier ISAPI based pipeline determines that the script mapping requires the request to handed over to ASP.NET.

AnthonyWJones
  • 187,081
  • 35
  • 232
  • 306
6

Just came across this problem. Using IIS6 and .NET 3.5. Fix for me was to use Response.AddHeader instead of Response.Headers.Add. HTH.

Michael Itzoe
  • 1,949
  • 4
  • 29
  • 49
0

Inspired by other answers, I've found that it's accessing the Response.Headers object that causes the "operation requires IIS integrated pipeline mode" exception.

Avoid .Headers and call other (older?) helper functions like:

  • Response.AddHeader() and
  • Response.ClearHeaders() (in my case!)
Russell
  • 530
  • 4
  • 10