Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nancy Self Hosting - Service Unavailable - Win7

Tags:

.net

nancy

I've scrapped what I was working with and went 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 to

   http://localhost:8080

I get:


Service Unavailable

HTTP Error 503. The service is unavailable.


I've tried several solutions. Including several variations on: Remote access to a Nancy Self Host

Any ideas?

like image 699
PerryJ Avatar asked Oct 01 '12 18:10

PerryJ


1 Answers

Make sure you are running Visual Studio as Administrator and that 8080 is not used by something else at the same time. Have a look at the self-hosting demo which sets up a couple of different URIs for a self-hosted application https://github.com/NancyFx/Nancy/blob/master/src/Nancy.Demo.Hosting.Self/Program.cs#L12

like image 122
TheCodeJunkie Avatar answered Oct 03 '22 01:10

TheCodeJunkie