Recently, I decided to remove a bunch of action level filters in the controller and replace them with one controller level filter.
Now I get 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 am sure the error is due to the fact that the action filter is linked twice, like what I changed. However, when I review the documentation here , I see that it points / 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>();
}