I'm throwing some load tests at my WebAPI Self Hosted application and have found that Ninject's Cache Pruning stalls the application for a few seconds (profiling under load in the screenshot).
How can I avoid having the Cache Pruning stall requests??
All I have done is set the HttpSelfHostConfiguration.DependencyResolver = new NinjectDependencyResolver(new StandardKernel()) (configuration omitted)
Is there a way to Remove the Object at the end of the request?
UPDATE:
From here, https://github.com/ninject/ninject/issues/37 , it seems that expecting the object to be removed at the end of the request can only be expected for Ninject.Web and Ninject.Web.MVC
UPDATE/NOTE:
I've been using the nuget package Ninject.Web.WebApi-RC, along with AttributeRouting.WebApi.Hosted.
UPDATE
I updated the scope and resolver definitions, now I find I have a hang... I'm now simply testing against an action which returns a string constant.
Use https://nuget.org/packages/Ninject.Web.WebApi.Selfhost
Here is an example how to use it: https://github.com/ninject/Ninject.Web.WebApi/tree/master/src/Ninject.Web.WebApi.Selfhost
It disposes objects InRequestScope at the end of the request.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.