我正在 asp.net 中开发一个应用程序,在该应用程序中我正在实现 Ninject 拦截器,我在其中绑定/注册服务,例如
kernel.Bind<IPracticeManagement>().To<PracticeManagementClient>().InRequestScope().Intercept().With<TimingInterceptor>();
当我调用此服务的方法时
public class HomeController : Controller
{
private readonly IPracticeManagement _practiceManagement;
public HomeController(IPracticeManagement practiceManagement)
{
this._practiceManagement = practiceManagement;
}
public ActionResult Index()
{
var specialities = this._practiceManagement.GetSpecialty();
this.ViewBag.Specialities = specialities;
ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
return View();
}
}
方法 BeforeInvoke 在 TimeInterceptor 中调用了两次。为什么?