You need to do this in two parts. First, implement your attribute class with which you will decorate the method that you wish to exclude.
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class ExcludeAttribute : Attribute
{
}
Then, in the ExecuteActionFilterAsync
method of your IActionFilter implementation, check if the action being invoked is decorated with this method.
public Task<HttpResponseMessage> ExecuteActionFilterAsync(HttpActionContext actionContext, CancellationToken cancellationToken, Func<Task<HttpResponseMessage>> continuation)
{
var excludeAttr = actionContext.ActionDescriptor.GetCustomAttributes<ExcludeAttribute>().SingleOrDefault();
if (excludeAttr != null) // Exclude attribute found; short-circuit this filter
return continuation();
... // Execute filter otherwise
}