All notes
Nancy

Walkthrough

Exception: UrlReservations.CreateAutomatically

SO.


class Program
{
    static void Main()
    {
        // wcf: add the following hostConfigs to nancyHost.
        HostConfiguration hostConfigs = new HostConfiguration();
        hostConfigs.UrlReservations.CreateAutomatically = true;

        using (var nancyHost = new NancyHost(hostConfigs, new Uri("http://localhost:8888/nancy/"), new Uri("http://127.0.0.1:8898/nancy/"), new Uri("http://localhost:8889/nancytoo/")))
        {
            nancyHost.Start();

            Console.WriteLine("Nancy now listening - navigating to http://localhost:8888/nancy/. Press enter to stop");
            try
            {
                Process.Start("http://localhost:8888/nancy/");
            }
            catch (Exception)
            {
            }
            Console.ReadKey();
        }

        Console.WriteLine("Stopped. Good bye!");
    }
}

Diagnostics

For logging and tracing. github.com: Nancy wiki.

You reach the dashboard by pointing your browser to http://ip/_Nancy/. However before being able to use the dashboard, you first need to configure it.


using Nancy;
using Nancy.Diagnostics;

public class CustomBootstrapper : DefaultNancyBootstrapper
{
    protected override DiagnosticsConfiguration DiagnosticsConfiguration
    {
        get { return new DiagnosticsConfiguration { Password = @"A2\6mVtH/XRT\p,B"}; }
    }
}