public void Configuration(IAppBuilder app) { // make sure we're logging log4net.Config.XmlConfigurator.Configure(); // configure http HttpConfiguration httpConfig = new HttpConfiguration(); // add the filters (e.g. requiring https) FilterConfig.RegisterHttpFilters(httpConfig.Filters); // add the handlers (e.g. logging and exception handling) LoggingConfig.RegisterHandlers(httpConfig.Services); WebSecurity.InitializeDatabaseConnection("ProviderPortalConnection", "UserProfile", "UserId", "UserName", autoCreateTables: true); UnityConfig.RegisterComponents(httpConfig); ConfigureOAuth(app, (ISettingsProvider)httpConfig.DependencyResolver.GetService(typeof(ISettingsProvider))); ConfigureWebApi(httpConfig); app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll); app.UseWebApi(httpConfig); }
/// <summary> /// Handles the Start event of the Application control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e"> /// The <see cref="EventArgs" /> instance containing the event data. /// </param> protected void Application_Start(object sender, EventArgs e) { ConfigureWebApiRouting( ); AreaRegistration.RegisterAllAreas( ); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); FilterConfig.RegisterHttpFilters(GlobalConfiguration.Configuration.Filters); MessageConfig.RegisterMessageHandlers(GlobalConfiguration.Configuration.MessageHandlers); FormatterConfig.ConfigureFormatters(GlobalConfiguration.Configuration.Formatters); #if DEBUG EventLog.Application.WriteError("System is running in debug mode. This message should not appear in production."); #endif if (HttpContext.Current != null && HttpContext.Current.IsDebuggingEnabled) { EventLog.Application.WriteError("Debug mode is set in web.config. This message should not appear in production."); } ///// // NOTE: Any application/tenant logic should be placed in the AppPreload rather than here... ///// }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); FilterConfig.RegisterHttpFilters(GlobalConfiguration.Configuration.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); }
protected void Application_Start(object sender, EventArgs e) { // Re-Map json properties. var json = GlobalConfiguration.Configuration.Formatters.JsonFormatter; json.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); json.SerializerSettings.Formatting = Newtonsoft.Json.Formatting.Indented; GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); FilterConfig.RegisterHttpFilters(GlobalConfiguration.Configuration.Filters); }
protected void Application_Start() { Database.SetInitializer(new MigrateDatabaseToLatestVersion <TechSupportDbContext, Configuration>()); RouteTable.Routes.Ignore("{resource}.axd/{*pathInfo}"); GlobalConfiguration.Configure(ODataConfig.Register); GlobalConfiguration.Configure(WebApiConfig.Register); List <ODataPayloadKind> data = new List <ODataPayloadKind>() { ODataPayloadKind.Value, ODataPayloadKind.Property, ODataPayloadKind.Collection, ODataPayloadKind.Parameter, ODataPayloadKind.Entry, ODataPayloadKind.Batch }; GlobalConfiguration.Configuration.Formatters.Insert(0, new ODataMediaTypeFormatter(data)); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); FilterConfig.RegisterHttpFilters(GlobalConfiguration.Configuration.Filters); GlobalConfiguration.Configuration.Filters.Add(new ElmahHandleErrorApiAttribute()); AutoMapperConfig.RegisterMappings(Assembly.Load(Constants.DataModelsAssembly)); }