Nancy Self Hosting - Service Unavailable - Win7

I gave up what I was working with and moved on to the simplest of code:

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!";
        };
    }
}

When i browse

   http://localhost:8080

I get:


Service is unavailable

HTTP Error 503. The service is not available.


I tried several solutions. Enabling Multiple Options: Nancy Remote Self-Service

Any ideas?

+5
source share
2 answers

Make sure that you are using Visual Studio as an administrator and that 8080you are not using any other at the same time. See a self-service demo that sets up several different URIs for a standalone application https://github.com/NancyFx/Nancy/blob/master/src/Nancy.Demo.Hosting.Self/Program.cs#L12

+5

, , 503, :

_nancyHost = new NancyHost(new HostConfiguration { 
        RewriteLocalhost = false
    }, 
    new Uri(string.Format("http://localhost:{0}", port)));

, http://localhost:3684/ Nancy, Windows

RewriteLocalHost true . , : Nancy?

0

All Articles