The ChannelAdam Nancy Self-Hosting Library

Overview

This is an open source (Apache License 2.0) .NET Standard 2.0 code library that provides some helpers for self-hosting the lightweight Nancy web framework.

This library builds upon the official Nancy Self-Hosting Library.

Getting Started

NuGet Package Installation

To install the ChannelAdam.Nancy.Hosting.Self NuGet package run the following command in the Package Manager Console:

1PM> Install-Package ChannelAdam.Nancy.Hosting.Self

Reference

NancySelfHostFactory

The NancySelfHostFactory provides functionality for creating and starting a self-hosted instance of Nancy.

The NancySelfHostFactory static class has nine methods:

  • public static HostConfiguration CreateHostConfiguration() - creates a Nancy HostConfiguration with the RewriteLocalhost property set to false to ensure that elevated permissions are not required to start Nancy.

  • public static NancyHost CreateAndStartNancyHost(params Uri[] baseUris) - creates and starts a self-hosted instance of Nancy using the host configuration created by CreateHostConfiguration().

  • public static NancyHost CreateAndStartNancyHost(HostConfiguration hostConfig, params Uri[] baseUris) - creates and starts a self-hosted instance of Nancy using the specified host configuration.

  • public static NancyHost CreateAndStartNancyHost(INancyBootstrapper bootstrapper, params Uri[] baseUris) - creates and starts a self-hosted instance of Nancy using the specified bootstrapper.

  • public static NancyHost CreateAndStartNancyHost(INancyBootstrapper bootstrapper, HostConfiguration hostConfig, params Uri[] baseUris) - creates and starts a self-hosted instance of Nancy using the specified bootstrapper and host configuration.

  • public static NancyHost CreateAndStartNancyHostInBackgroundThread(params Uri[] baseUris) - creates and starts a self-hosted instance of Nancy - in a background thread - using the host configuration created by CreateHostConfiguration().

  • public static NancyHost CreateAndStartNancyHostInBackgroundThread(HostConfiguration hostConfig, params Uri[] baseUris) - creates and starts a self-hosted instance of Nancy - in a background thread - using the specified host configuration.

  • public static NancyHost CreateAndStartNancyHostInBackgroundThread(INancyBootstrapper bootstrapper, params Uri[] baseUris) - creates and starts a self-hosted instance of Nancy - in a background thread - using the specified bootstrapper.

  • public static NancyHost CreateAndStartNancyHostInBackgroundThread(INancyBootstrapper bootstrapper, HostConfiguration hostConfig, params Uri[] baseUris) - creates and starts a self-hosted instance of Nancy - in a background thread - using the specified bootstrapper and host configuration.