Garfield
Garfield

Reputation: 1232

nancy razor first time setup - route not found 404

Steps I took to setup project:

  1. created new asp.net project
  2. Install-Package Nancy.Viewengines.Razor
  3. added Views/hello.cshtml (simple hello world html)
  4. added MainModule.cs
  5. hit ctrl-F5 (it returns the directory listing)
  6. change url to localhost:41915/hello

Then I get 404 resource not found.
What am I missing?

// MainModule.cs

namespace MyProj
{
    using Nancy.Routing;
    using Nancy;

    public class MainModule : NancyModule
    {
        public MainModule(IRouteCacheProvider routeCacheProvider)
        {
            Get["/hello"] = parameters => {
                return View["hello.cshtml"];
            };

        }
    }
}

Upvotes: 2

Views: 901

Answers (1)

Steven Robbins
Steven Robbins

Reputation: 26599

You need the Nancy.Hosting.AspNet package too.

Upvotes: 3

Related Questions