加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

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

发布时间:2020-12-14 01:53:06 所属栏目:Windows 来源:网络整理
导读:我已经废弃了我正在使用的内容并转到了最简单的代码: 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()
我已经废弃了我正在使用的内容并转到了最简单的代码:

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读