0

I'm having a bit of a play around with IIS7, just trying to catch events manually in global.asax and skip the ASP httphandler pipeline entirely. To this end, I've set

<httpHandlers>
    <clear/>
</httpHandlers>
<httpModules>
    <clear/>
</httpModules>   

but when I call the server I get a YSOD

[HttpException]: No http handler was found for request type 'GET'
   at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig)
   at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

What do I need to do to completely prevent IIS from handling things using the conventional pipeline? What I want is just to do Response.Writes in event handlers and async methods set up in HttpApplication.Init

edit: My question was obv. a bit unclear (sorry to anyone whose time was wasted) - I should have explained better as what I'm trying to do is pretty unconventional. I'm trying to see if I can use IIS to handle web requests in a manner similar to node.js - by wiring handlers up to the async methods in HttpApplication. To this end I need ASP to stop throwing a wobbly because I don't want to use HttpHandlers. Currently my best bet is to use a NullHttpHandler for all requests, but I'm wondering if I can disable the HttpHandler system completely. Your ideas!

mcintyre321
  • 12,996
  • 8
  • 66
  • 103

3 Answers3

0

You have to re-add the StaticFileHandler:

  <httpHandlers>
    <clear />
    <add verb="*" path="*.jpg" type="System.Web.StaticFileHandler" />
  </httpHandlers>
bgs264
  • 4,572
  • 6
  • 38
  • 72
  • Or replace *.jpg with whatever: In my example I handle images from the database but want all images in /images coming from the directory directly... – bgs264 Apr 01 '10 at 11:19
  • Will this not just make all my requests get handled statically? I want to handle them with code. – mcintyre321 Apr 01 '10 at 11:31
  • Yes; misunderstood your question. If you want to handle them with code then you need to add the relevant handlers: You're getting an error because you've removed ALL handlers so there's nothing left to handle your requests.... In IIS you map the file types to be handled by the asp.net framework same as .aspx, .ashx, etc... As per driis response. – bgs264 Apr 01 '10 at 11:42
  • (A YSOD means the request is already handled by .net - if it wasn't you'd get a standard http error code back... So IIS is set up correctly, right?) – bgs264 Apr 01 '10 at 11:42
0

You need IIS. The request starts in the IIS pipeline, and for ASP .NET to handle it, IIS needs to be able to find a http handler, it can pass the request to. It passes the request to ASP .NET only once it has found an appropiate handler.

driis
  • 161,458
  • 45
  • 265
  • 341
0

I know its a bit old... but if you in your ie. BeginRequest event of HttpApplication assign a handler to HttpContext.Current.Handler you shouldn't get this error and can leave the handlers-section in web.config empty.

Pauli Østerø
  • 6,878
  • 2
  • 31
  • 48