MVC and Global Request Filters

We have been using MVC integration for a few years now, and have been sharing the IoC container between our AppHost and MVC.

Just recently, we’ve needed to add a GlobalRequestFilter to our service, that is required to run before our Controllers can use certain dependencies in the IoC that are ReuseScope.Request.

However, it appears that the global request filter we have does not run on a web request for a controller action.

Is there a way to invoke GlobalRequestFilters defined in a service from a MVC Controller action?
(Or am I looking at adding custom MVC ActionFilterAttribute classes and registering them in FilterConfig.RegisterGlobalFilters to do what my global request filters do?)

The AppHost.GlobalRequestFilters like all ServiceStack static configuration should only be configured once on Startup, not in a Service at runtime. They’re also only meant and executed for ServiceStack Requests.

If you’re referring to Filter Attributes you can have a look at how the ExecuteServiceStackFiltersAttribute is implemented for how the Authenticate Attributes are implemented in MVC Controller Requests. You can’t just execute the filter attribute directly, but you can refactor some shared code that you can execute for both ServiceStack and MVC Requests.