我已经废弃了我正在使用的内容并转到了最简单的代码:
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
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。