I have a very simple Web Api v2.2 self hosted in OWIN
public class StartUp
{
public void Configuration(IAppBuilder appBuilder, IConfigReader configReader)
{
var container = new Container();
container.Register<IConfigReader, ConfigReader>();
var config = new HttpConfiguration();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
config.DependencyResolver = new SimpleInjectorWebApiDependencyResolver(container);
appBuilder.UseWebApi(config);
}
}
When I then use on my Main()
as:
WebApp.Start(baseAddress, appBuilder =>
new StartUp().Configuration(appBuilder, new ConfigReader()));
However when I try to execute the last line appBuilder.UseWebApi(config);
I get the following exception:
A first chance exception of type 'SimpleInjector.ActivationException' occurred in SimpleInjector.dll
Additional information: The given type IHostBufferPolicySelector is not a concrete type. Please use one of the other overloads to register this type.
Complete Stack:
SimpleInjector.ActivationException occurred _HResult=-2146233088
_message=The given type IHostBufferPolicySelector is not a concrete type. Please use one of the other overloads to register this type.
HResult=-2146233088 IsTransient=false Message=The given type IHostBufferPolicySelector is not a concrete type. Please use one of the other overloads to register this type. Source=SimpleInjector
StackTrace: at SimpleInjector.Advanced.DefaultConstructorResolutionBehavior.VerifyTypeIsConcrete(Type implementationType) InnerException:
The problem is not that single interface it looks like SimpleInjector
is trying to find a binding for Every Single Interface; If I provide a dummy implementation for IHostBufferPolicySelector
it throws for some other interface e.g. IExceptionHandler
etc.
There is a related thread HERE but I am not sure how it relates to SimpleInjector
?
The Self host is a Console App which has the following packages installed:
According to Simple Injector:
The exceptions you are showing are 'first chance exceptions'. These exceptions are thrown by Simple Injector but they are caught and processed by Simple Injector and they won't bubble up the call stack. It is possible that you see them in some debugger output window, but they are quite normal and nothing to worry about.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With