Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
502 views
Welcome To Ask or Share your Answers For Others

1 Answer

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}


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...