Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to map an HttpHandler to a "path/*" wildcard mapping

Tags:

So I've been trying to map an http module to a sub-path of an MVC3 site. It should be pretty simple as I understand it, but it has not been working. The module is setup like so:

<handlers>   <add name="Nancy" path="api/*" verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" allowPathInfo="true" /> </handlers> 

A matching section is also there for iis6 so I can run it under webdev.webserver. However testing both deploying to my local iis7 (under Win7) and with webdev.webserver, only /api actually calls the handler. If I call /api/{anything} it just returns a 404.

I'm sure I'm just "doing it wrong (tm)" but any help would be appreciated.

Note: I've also tried a couple other configurations including using a tag and creating a /api folder and adding a web.config to that folder with a full wildcard.

like image 528
Chris Nicola Avatar asked May 09 '11 21:05

Chris Nicola


People also ask

What is handler mapping in IIS?

Use the Handler Mappings feature page to manage a list of handlers that process requests for specific file types. Sort the list by clicking one of the feature page column headings or select a value from the Group by drop-down list to group similar items. Related scenarios. Build a Static Website on IIS.

What are HttpHandlers c#?

An HTTPhandler may be defined as an end point that is executed in response to a request and is used to handle specific requests based on extensions. The ASP.Net runtime engine selects the appropriate handler to serve an incoming request based on the file extension of the request URL.

What is the use of HTTPhandler?

An ASP.NET HTTP handler is the process that runs in response to a request that is made to an ASP.NET Web application. The most common handler is an ASP.NET page handler that processes . aspx files.


1 Answers

Simple. Just put the path, no wildcard.

<handlers>   <add name="Nancy" path="api" verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" allowPathInfo="true" /> </handlers> 

This will match:

/api/{anything}

like image 178
ThinkingStiff Avatar answered Oct 06 '22 18:10

ThinkingStiff