The Setup: I have a almost out-of-the-box Nancy + TinyIoC setup running a webservice which works fine. It depends on various (AsSingleton) service classes. However these are not injected as Singletons, a new instance is created each time.
I have setup the Nancy bootstrapper as follows:
class MyBootStrapper : DefaultNancyBootstrapper
{
protected override void ConfigureApplicationContainer(TinyIoCContainer container)
{
var cp = new CertificateProvider();
container.Register(cp).AsSingleton();
}
}