IgorShare Thoughts and Ideas

Consulting and Training

Archive for April 8th, 2012

Adding Nancy to the existing ASP.NET MVC site

Posted by Igor Moochnick on 04/08/2012

There is an issue adding Nancy to the ASP.Net MVC site due to a simple fact that MVC controls the routes not through the web.config but through the routing table.

If you adding Nancy to the existing MVC site – make sure to remove the sub-route that controlled by Nancy from the routing table.

Here how it works:

1. Follow all the steps from the Nancy Documentation Wiki

2. Add your module and make sure that it has an “offset” path (via inheritance)

public Module() : base("/nancy")
{
   ...
}

3. Remove the "nancy" route from the Routing table in the Global.asax.cs

MvcApplication.RegisterRoutes(...)
{
   ...
   routes.IgnoreRoute("nancy/{*pathInfo}");
   ...
}

Posted in C#, Web | 5 Comments »

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: