protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); RouteConfig.RegisterRoutes(RouteTable.Routes); SwaggerConfig.Register(); }
public void Configuration(IAppBuilder app) { var config = new HttpConfiguration(); config.MapHttpAttributeRoutes(); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "v1/{controller}/{id}", defaults: new { id = RouteParameter.Optional }); // This is the call to our swashbuckle config that needs to be called SwaggerConfig.Register(); // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=316888 app.UseOAuthBearerAuthentication( new OAuthBearerAuthenticationOptions() { AccessTokenFormat = new JwtFormat( new TokenValidationParameters() { ValidAudiences = new[] { Audience, $"api://{Audience}" }, ValidateIssuer = false }, new OpenIdConnectSecurityTokenProvider($"{Issuer}/.well-known/openid-configuration")) }); }
public void Configuration(IAppBuilder app) { // Order matters for OWIN pipeline, set OAuth config first. ConfigureOAuth(app); HttpConfiguration config = new HttpConfiguration(); WebApiConfig.Register(config); app.UseWebApi(config); SwaggerConfig.Register(config); }
// This method gets called by the runtime. Use this method to add services to the container. public IServiceProvider ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); SwaggerConfig.Register(services); return(AutofacConfig.Configure(builder => { var types = Assembly.Load("Sqr.DC.Business").GetTypes().Where(c => c.IsSubclassOf(typeof(Autofac.Module))); builder.RegisterAssemblyModules(Assembly.GetExecutingAssembly()); builder.RegisterAssemblyModules(Assembly.Load("Sqr.DC.Business")); builder.RegisterAssemblyModules(Assembly.Load("Sqr.DC.EF")); builder.Populate(services); return null; })); }
public void Configuration(IAppBuilder app) { HttpConfiguration config = new HttpConfiguration(); config.MessageHandlers.Add(new ServerCompressionHandler(new GZipCompressor(), new DeflateCompressor())); config.MessageHandlers.Add(new LogHandler()); config.MessageHandlers.Add(new CustomThrottlingHandler()); WebApiConfig.Register(config); Injector.ConfiguracaoSimpleInjector.StartSimpleInjetor(config); ConfigureOAuth(app, config); SwaggerConfig.Register(config); app.UseWebApi(config); }
public void Bulid() { string WcsApiServer = Properties.Resources.WcsApiServer; var config = new HttpSelfHostConfiguration(WcsApiServer); config.MapHttpAttributeRoutes(); //config.Formatters.Add(new PlainTextTypeFormatter()); config.Routes.MapHttpRoute(name: "DefaultApi", routeTemplate: "api/{controller}/{action}/{id}", defaults: new { id = RouteParameter.Optional }); SwaggerConfig.Register(config); using (var sever = new HttpSelfHostServer(config)) { sever.OpenAsync().Wait(); while (true) { } } }
public void Configuration(IAppBuilder app) { app.UseCors(CorsOptions.AllowAll); OAuthAuthorizationServerOptions option = new OAuthAuthorizationServerOptions { TokenEndpointPath = new PathString("/api/account/login"), Provider = new ApplicationOAuthProvider(), AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(60), AllowInsecureHttp = true }; app.UseOAuthAuthorizationServer(option); app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions()); var config = new HttpConfiguration(); WebApiConfig.Register(config); app.UseWebApi(config); #if DEBUG SwaggerConfig.Register(config); #endif }