简体   繁体   English

南希自我主持人不打电话给模块?

[英]Nancy Self Host doesn't call Module?

I am working on adding Nancy Framework to my C# console application (followed the very short tutorial here and it loads a blank page when I go to http://localhost:1234 so I know it is starting, but it doesn't show my text properly. I have gone over my code various times, but don't see any issues. 我正在努力将Nancy Framework添加到我的C#控制台应用程序中(遵循这里非常简短的教程,当我转到http:// localhost:1234时它会加载一个空白页面,所以我知道它正在启动,但它没有显示我的文本正确。我已经多次查看我的代码,但没有看到任何问题。

I have added both Nancy and Nancy.Hosting.Self to my project. 我已将Nancy和Nancy.Hosting.Self添加到我的项目中。

        static void Main(string[] args)
        {
            var nancyHost = new Nancy.Hosting.Self.NancyHost(new Uri("http://localhost:1234"));
            nancyHost.Start();
            Console.ReadLine();
            nancyHost.Stop();
        }

namespace DaemonApp
{
    class MainModule : Nancy.NancyModule
    {
        public MainModule()
        {
            Get["/"] = parameters =>
            {
                return "Hello world!";
            };
        }
    }
}

I added some print lines, and it never calls the module when I visit the page. 我添加了一些打印行,当我访问页面时它从不调用模块。 Does anyone have any clue what the issue is? 有没有人知道问题是什么?

我没有让Module类公开,立即修复它= /

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM