南希自我主持 returns 404
Nancy self host returns 404
我有一个控制台应用程序,我想使用 Nancy 来托管 Web 服务。
这是我的 Program.cs
namespace NancyConsole
{
using Nancy.Hosting.Self;
using System;
internal class Program
{
private static void Main(string[] args)
{
string url = "http://localhost:1234";
var host = new NancyHost(new Uri(url));
host.Start();
Console.WriteLine("Server started, now listening on " + url);
Console.WriteLine("Press any key to stop the server...");
Console.ReadKey();
host.Stop();
}
}
}
这是我的 MainModule.cs 文件
namespace NancyConsole
{
using Nancy;
internal class MainModule : NancyModule
{
public MainModule()
{
Get["/"] = x => View["Views/index.html"];
}
}
}
这是我的项目结构
当我 运行 项目时,这是我在浏览器上遇到的错误
我不知道我哪里错了?非常感谢您的帮助!
制作模块public。默认加载策略使用反射查找public模块类.
public class MainModule : NancyModule
It is important that you declare your module public, otherwise NancyFx is not able to discover your module.
我有一个控制台应用程序,我想使用 Nancy 来托管 Web 服务。 这是我的 Program.cs
namespace NancyConsole
{
using Nancy.Hosting.Self;
using System;
internal class Program
{
private static void Main(string[] args)
{
string url = "http://localhost:1234";
var host = new NancyHost(new Uri(url));
host.Start();
Console.WriteLine("Server started, now listening on " + url);
Console.WriteLine("Press any key to stop the server...");
Console.ReadKey();
host.Stop();
}
}
}
这是我的 MainModule.cs 文件
namespace NancyConsole
{
using Nancy;
internal class MainModule : NancyModule
{
public MainModule()
{
Get["/"] = x => View["Views/index.html"];
}
}
}
这是我的项目结构
当我 运行 项目时,这是我在浏览器上遇到的错误
我不知道我哪里错了?非常感谢您的帮助!
制作模块public。默认加载策略使用反射查找public模块类.
public class MainModule : NancyModule
It is important that you declare your module public, otherwise NancyFx is not able to discover your module.