public void Configuration(IAppBuilder app, Func <IContainer> containerBuilder) { #if DEBUG LocalConfiguration.SetEnvironmentVariables(); #endif var container = (containerBuilder ?? DefaultContainerBuilder)(); var config = new HttpConfiguration(); EnableCors(config); config.MapHttpAttributeRoutes(); config.DependencyResolver = new AutofacWebApiDependencyResolver(container); app.UseAutofacMiddleware(container); app.UseWebApi(config); }