0
Reply

Help required to add Nancy to existing asp.net web

David Huisman

David Huisman

Feb 26 2017 4:38 PM
239
I am having trouble getting nancy running with asp.net project.
 
First I used newget to install nancy and nancy.hosting.aspnet 
 
Then I changed the path for the nancy handlers in root web.config...
 
<add verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="api/*"
 
Next, I created a folder in my solution explorer named "api" and created a web.config within the new folder and added the code below...
 
<httpHandlers>
<add verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*"/>
</httpHandlers> 
 
Finally I created a class to test the app...
 
public class TestNancy : NancyModule
{
public TestNancy() : base("/api")
{
Get["/status"] = _ => "Hello World";
}
 
When I run the app, I get the web part working fine on the root page. I then navigate to /api/status and get no response.