Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I've recently taken an existing ASP.NET 3.5 web forms application that was upgraded to .NET 4 last year (and has been running fine) and configured it to also run ASP.NET MVC3 following Scott Hanselman's blog post: Integrating ASP.NET MVC 3 into existing upgraded ASP.NET 4 Web Forms applications. It works well and I've successfully begun to introduce views based on Razor and the existing aspx pages continue to work.

The one thing that has stopped working, however, is a custom HttpHandler (our load balancer hits a specific address to ensure the application is available - the handler is for that address). The web.config has always declared the handler in the system.web section like this:

<httpHandlers>
  <add verb="*" path="system/heartbeat.aspx"
    type="My.Monitor.HttpHandlers.LoadBalancerHandler, My.Monitor"/>
</httpHandlers>

Now we're testing post-MVC3 and I'm getting an exception that reads:

The controller for path '/system/heartbeat.aspx' was not found or does not implement IController.

I have defined a RegisterRoutes method in my Global.asax and that method is called from the Application_Start. Within RegisterRoutes I've got the IgnoreRoute declarations from Hanselman's blog:

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("{resource}.aspx/{*pathInfo}");

which I thought was to prevent the Routing system from taking anything with an extension of .aspx.

I can reproduce the issue in VS2010 as I debug, and the deployment environment is running IIS 6.

What can I do to prevent the Routing system from trying to handle that address so the custom handler can do it's thing? Any help is appreciated.

share|improve this question
add comment

1 Answer

up vote 8 down vote accepted

Try like this:

routes.IgnoreRoute("system/heartbeat.aspx");
share|improve this answer
    
Thanks, Darin, that seems to have taken care of it. I still don't understand why the routes.IgnoreRoute("{resource}.aspx/{*pathInfo}"); didn't do the trick - but I can live with mystery as long as stuff works. –  BigPigVT Apr 1 '11 at 17:19
    
@BigPigVT, the following blog post provides a good insight about the IgnoreRoute extension method. –  Darin Dimitrov Apr 1 '11 at 17:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.