nancy razor第一次设置 - 路线未找到404

时间:2013-05-14 01:14:56

标签: nancy

我设置项目的步骤:

  1. 创建了新的asp.net项目
  2. 安装包Nancy.Viewengines.Razor
  3. 添加了Views / hello.cshtml(简单的hello world html)
  4. 添加了MainModule.cs
  5. 点击ctrl-F5(它返回目录列表)
  6. 将网址更改为localhost:41915 / hello
  7. 然后我找不到404资源 我错过了什么?

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

1 个答案:

答案 0 :(得分:3)

您也需要Nancy.Hosting.AspNet软件包。