Recently I decided to remove a heap of action level filters in a controller and replace them with a single controller level filter.
Now I'm getting this error message.
Error activating LogActionFilter More than one matching bindings are available. Activation path: 1) Request for LogActionFilter Suggestions: 1) Ensure that you have defined a binding for LogActionFilter only once.
I'm sure the error is related to action filter being bound twice, as that's what I've changed. However, when I view the documentation here I can see it specifies/does the same. So I'm really not sure what I'm doing wrong.
My sample controller
[LogAction]
public class SomeController : Controller
{
public ActionResult SomeAction()
{
}
}
My registration code
public static void RegisterFilters()
{
Kernel.BindFilter<LogActionFilter>(FilterScope.Controller, 0)
.WhenControllerHas<LogActionAttribute>();
Kernel.BindFilter<LogActionFilter>(FilterScope.Action, 0)
.WhenActionMethodHas<LogActionAttribute>();
}
This happens if your controller and one of its actions have the LogActionAttribute at the same time.