Problem mapping HttpHandler --> HTTP Error 404 Not Found

前端 未结 7 1884
误落风尘
误落风尘 2020-12-29 02:14

I am having problems trying to map an HttpHandler in the web.config.

This is the relevant config bit:


  

        
7条回答
  •  星月不相逢
    2020-12-29 03:01

    None of the previous answers worked for me.
    I'm using IIS 8.5, .Net v4.0, Integrated, and was still getting a 404 with the following handler config:

    
        
           
        
    
    


    I enabled tracing and found the following :

    116. -HANDLER_CHANGED 
    
        OldHandlerName              testEmail 
        NewHandlerName              System.Web.Mvc.MvcHandler 
        NewHandlerModules           ManagedPipelineHandler 
        NewHandlerScriptProcessor
        NewHandlerType              System.Web.Mvc.MvcHandler, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 
    


    As you can see it looks like it had correctly picked up the request using my custom HttpHandler testEmail but MVC had stolen it.
    I opened my route definitions in RouteConfig.cs and found that adding:

       routes.IgnoreRoute("{resource}.em");
    

    I got it to ignore requests meant for my Handler.
    Hope this helps someone - I was tearing my hair out!

提交回复
热议问题