I'm trying to setup Web API project that uses OWIN and NInject middleware. I've installed Ninject.Web.WebApi.OwinHost nuget package and created the following startup class:
public class Startup
{
public void Configuration(IAppBuilder appBuilder)
{
var httpConfig = new HttpConfiguration();
WebApiConfig.Register(httpConfig);
appBuilder.UseNinjectMiddleware(CreateKernel);
appBuilder.UseNinjectWebApi(httpConfig);
}
private StandardKernel CreateKernel()
{
var kernel = new StandardKernel();
return kernel;
}
}
This code throws the following exception during initialization when creating StadardKernel:
Type 'SomeType' in assembly 'SomeAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
I'm very confused why this error is returned as I haven't registered any bindings yet. Type SomeType is in third party assembly I'm using and cannot be modified.