我有一个控制台应用程序,我想使用Nancy托管一个web服务。
这是我的
程序反恐精英
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();
}
}
}
这是我的
主模块。反恐精英
文件
namespace NancyConsole
{
using Nancy;
internal class MainModule : NancyModule
{
public MainModule()
{
Get["/"] = x => View["Views/index.html"];
}
}
}
当我运行项目时,这是我在浏览器上遇到的错误
我不知道我哪里出错了?非常感谢您的帮助!