-
Notifications
You must be signed in to change notification settings - Fork 40
Setting up a self hosted web application
remogloor edited this page Jan 13, 2013
·
13 revisions
This chapter explains how to setup an application in case you want to host the web services yourself in you application instead of deploying the application to IIS.
The first step is to add a reference to Ninject.Web.Common.Selfhost either by adding the reference manually or install the corresponding NuGet Package.
The second step is to create and start a NinjectSelfHostBootstrapper instance in cour composition root of your application like shown in the following example:
```text
private void StartNinjectSelfHost()
{
var someServiceConfiguration = ... // Configurations are specific to the type of
var anotherServiceConfiguration = ... // web service. Please read the documentation for
// the technology you are using.
this.selfHost = new NinjectSelfHostBootstrapper(
CreateKernel,
someServiceConfiguration,
anotherServiceConfiguration);
this.selfHost.Start();
}
///
/// Creates the kernel.
///
/// the newly created kernel.
private static StandardKernel CreateKernel()
{
var kernel = new StandardKernel();
kernel.Load(Assembly.GetExecutingAssembly());
return kernel;
}
```