public void Configuration(IAppBuilder app) { // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888 _container = IoCConfig.RegisterDependencies(app); DependencyResolver.SetResolver(new AutofacDependencyResolver(_container)); var config = new HttpConfiguration {DependencyResolver = new AutofacWebApiDependencyResolver(_container)}; WebApiConfig.Register(config); app.UseAutofacMiddleware(_container); //app.UseAutofacWebApi(config); app.UseWebApi(config); app.UseAutofacMvc(); app.ConfigureUbikAuth(); }