gpt4 book ai didi

南希 Razor 第一次设置 - 找不到路线 404

转载 作者:行者123 更新时间:2023-12-04 04:57:54 26 4
gpt4 key购买 nike

我设置项目的步骤:

  • 创建新的 asp.net 项目
  • 安装包 Nancy.Viewengines.Razor
  • 添加了 Views/hello.cshtml(简单的 hello world html)
  • 添加了 MainModule.cs
  • 点击 ctrl-F5(它返回目录列表)
  • 将 url 更改为 localhost:41915/hello

  • 然后我得到 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"];
    };

    }
    }
    }

    最佳答案

    您也需要 Nancy.Hosting.AspNet 包。

    关于南希 Razor 第一次设置 - 找不到路线 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16533625/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com