.net – Nancy Self Hosting – 服务不可用 – Win7

我已经废弃了我正在使用的内容并转到了最简单的代码

class Program
{
    static void Main(string[] args)
    {
        var nancyHost = new Nancy.Hosting.Self.NancyHost(new   Uri("http://localhost:8080"));
        nancyHost.Start();

        Console.ReadLine();
        nancyHost.Stop();
    }
}
public class MainModule : Nancy.NancyModule
{
    public MainModule()
    {
        Get["/"] = x =>
        {
            return "Hello World!";
        };
    }
}

当我浏览

http://localhost:8080

我明白了:

暂停服务

http错误503服务不可用.

我尝试了几种解决方案.包括以下几种变体:Remote access to a Nancy Self Host

有任何想法吗?

解决方法

确保以管理员身份运行Visual Studio,并且8080不会被其他内容同时使用.看看自托管演示,它为自托管应用程序 https://github.com/NancyFx/Nancy/blob/master/src/Nancy.Demo.Hosting.Self/Program.cs#L12设置了几个不同的URI

相关文章

Windows2012R2备用域控搭建 前置操作 域控主域控的主dns:自...
主域控角色迁移和夺取(转载) 转载自:http://yupeizhi.blo...
Windows2012R2 NTP时间同步 Windows2012R2里没有了internet时...
Windows注册表操作基础代码 Windows下对注册表进行操作使用的...
黑客常用WinAPI函数整理之前的博客写了很多关于Windows编程的...
一个简单的Windows Socket可复用框架说起网络编程,无非是建...