title: FluentValidation with Owin ignores [FromUri] Dtos in Asp.Net WebApi2
body: <p>I'm developing an ASP.NET WebApi2 (.NET 4.7.2) with Owin and Autofac as IOC container. The Dtos shall get validated with FluentValidation before reaching the controller. Here is my project configuration:</p>
  <pre><code>public class Startup
  {
      public void Configuration(IAppBuilder app)
      {
          ...             
          var config = new HttpConfiguration();
          config.Filters.Add(new ValidateDtoStateFilter());
          ...
          FluentValidationModelValidatorProvider.Configure(config);
          ...
      }
  }
  </code></pre>
  <p>Validate dto state filter:</p>
  <pre><code>public class ValidateDtoStateFilter : ActionFilterAttribute
      {
          public override void OnActionExecuting(HttpActionContext actionContext)
          {
              if (!actionContext.ModelState.IsValid)
              {
                  throw new ValidationException(actionContext.ModelState
                      .SelectMany(ms =&gt; ms.Value.Errors
                          .Select(er =&gt; new ValidationFailure(ms.Key.Split('.')[1].FromPascalToCamelCase(), er.ErrorMessage))));
              }
          }
      }
  </code></pre>
  <p>Autofac builder configuration:</p>
  <pre><code>builder.RegisterAssemblyTypes(typeof(MyDtoValidator).Assembly)
                     .Where(t =&gt; t.Name.EndsWith(&quot;Validator&quot;))
                     .AsImplementedInterfaces()
                     .InstancePerLifetimeScope();
  builder.RegisterType&lt;FluentValidationModelValidatorProvider&gt;().As&lt;ModelValidatorProvider&gt;();
  builder.RegisterType&lt;AutofacValidatorFactory&gt;().As&lt;IValidatorFactory&gt;().SingleInstance();
  </code></pre>
  <p>Autofac validator factory:</p>
  <pre><code>public class AutofacValidatorFactory : ValidatorFactoryBase
  {
      private readonly IComponentContext _context;
  
      public AutofacValidatorFactory(IComponentContext context)
      {
          _context = context;
      }
  
      public override IValidator CreateInstance(Type validatorType)
      {
          object instance;
  
          return _context.TryResolve(validatorType, out instance) ? instance as IValidator : null;
      }
  }
  </code></pre>
  <p>It works fine with POST or PUT endpoints where the dto comes <code>[FromBody]</code> in the requets payload. It does <strong>not</strong> work with <code>[FromUri]</code> dtos, e.g. in a GET request. The validator will be created by Autofac, but in <code>OnActionExecuting</code> of <code>ValidateDtoStateFilter</code> <code>actionContext.ModelState</code> is always true, no matter if the supplied data is valid or not.</p>
  <p>How can I achieve that <code>[FromUri]</code> dtos get validated by the FluentValidation middleware as well?</p>
  <h2 id="update-t3tg">Update</h2>
  <p>The issue does not occur any more without my having changed anything.</p>