3

I'm trying to run an httphandler (ashx) in a asp.net 4 website.

When I call it from Visual Studio integrated server, it returns a 404 error.

It works if I call it on the site configured into the local IIS.

Someone could help?

opaera
  • 31
  • 3

1 Answers1

2

Are you using ASP.NET MVC, or System.Web.Routing?

Do you have something like

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

in your RegisterRoutes() function in your HttpApplication instance?

One thing to keep in mind is that the Visual Studio server thingie runs all requests through the managed pipeline.

Is the httpHandler added to the system.web section of the Web.config file? (In IIS7, this goes under the system.webServer section, but I am not sure if newer versions of Cassini will look there.)

Nicholas Piasecki
  • 25,203
  • 5
  • 80
  • 91
  • Thanks for the answer. Classic asp.net site, no MVC, no Routing. In the web.config file I havve this: – opaera Aug 15 '10 at 15:22
  • Try adding an appropriate httpHandler under the old section. Cassini predates IIS7, I doubt that they updated it to look in the IIS7 section. Could be wrong on this, though, but worth a shot. – Nicholas Piasecki Aug 15 '10 at 15:29
  • It works!! Thanks. Just a question, when I deploy it, I don't need the section in the System.Web right ? – opaera Aug 15 '10 at 15:33
  • 1
    No, but it doesn't hurt to leave it there. IIS6 & Cassini look at system.web/httpHandlers, and IIS7 looks at system.webServer/handlers. This is because the IIS team yells "Do over!" every few years, so we repeat ourselves if we need to support the multiple versions in our applications. – Nicholas Piasecki Aug 15 '10 at 15:41