我已经废弃了我正在使用的内容并转到了最简单的代码:
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!";
};
}
}
Run Code Online (Sandbox Code Playgroud)
当我浏览
http://localhost:8080
Run Code Online (Sandbox Code Playgroud)
我明白了:
暂停服务
http错误503服务不可用.
我尝试了几种解决方案.包括以下几种变体:远程访问南希自我主机
有任何想法吗?
确保以管理员身份运行Visual Studio,并且8080不会同时使用其他内容.看看自托管演示,它为自托管应用程序设置了几个不同的URI https://github.com/NancyFx/Nancy/blob/master/src/Nancy.Demo.Hosting.Self/Program的.cs#L12
| 归档时间: |
|
| 查看次数: |
2902 次 |
| 最近记录: |