I am building a Nancy based application which uses the NancyHost
as the embedded web server.
I am also trying to serve some static content, by creating a custom bootstrapper as described in their documentation here. However, the problem I see is that this custom bootstrapper class is never instantiated and the ConfigureConventions
method is never called. Is there any specific action that I have to do in order to make sure this custom bootstrapper is registered?
The custom bootstrapper code below:
using Nancy;
using Nancy.Conventions;
using System;
namespace Application
{
public class CustomBootstrapper : DefaultNancyBootstrapper
{
protected override void ConfigureConventions(NancyConventions conventions)
{
Console.WriteLine("test");
conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("client", @"client"));
conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("lib", @"lib"));
base.ConfigureConventions(conventions);
}
}
}
It turns out that I had to pass the reference to my CustomBootstrapper in the NancyHost constructor.
var host = new NancyHost(new Uri(JsonHelper.URL), new CustomBootstrapper(), config);
host.Start();
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments