Exemplo n.º 1
0
        public void Configuration(IAppBuilder app)
        {
            Framework.Core.ServerInfo.ServerPath = System.Web.HttpRuntime.AppDomainAppPath;
            container = new WindsorContainerConfigurator().Configure(app); // Castel Windsor initialize

            WebApiConfig.App = app;
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            #region Automapper Initialize

            Mapper.Initialize(cfg => { container.ResolveAll <Profile>().ToList().ForEach(cfg.AddProfile); });

            #endregion Automapper Initialize

            app.Use <CustomAuthenticationMiddleware>();
            ConfigAuth.Container = container;
            ConfigAuth.ConfigureOAuthTokenGeneration(app);
            ConfigAuth.ConfigureOAuthTokenConsumption(app);
        }
Exemplo n.º 2
0
        public void Configuration(IAppBuilder app)
        {
            try
            {
                var diagnosticsConnectionString =
                    CloudConfigurationManager.GetSetting(GlobalConstants.DIAGNOSTICS_STORAGE_CONNECTIONSTRING_CONFIGNAME);

                var level =
                    CloudConfigurationManager.GetSetting(GlobalConstants.GERES_CONFIG_DIAGNOSTICS_LEVEL);

                Geres.Diagnostics.GeresEventSource.StartDiagnostics(
                    RoleEnvironment.CurrentRoleInstance.Id,
                    diagnosticsConnectionString,
                    level
                    );
            }
            catch (Exception ex)
            {
                Trace.TraceError("FATAL ERROR - unable to initialize GERES Diagnostics Component at Run()-method: {0}. Recycling role...", ex.Message);
                RoleEnvironment.RequestRecycle();
            }

            try
            {
                GeresEventSource.Log.JobHubInitializing(RoleEnvironment.CurrentRoleInstance.Id, RoleEnvironment.DeploymentId);

                ConfigAuth.Configure(app);
                ConfigSignalR.Configure(app);
                GlobalConfiguration.Configure(ConfigWebApi.Configure);

                GeresEventSource.Log.JobHubInitialized(RoleEnvironment.CurrentRoleInstance.Id, RoleEnvironment.DeploymentId);
            }
            catch (Exception ex)
            {
                GeresEventSource.Log.JobHubFailure(RoleEnvironment.CurrentRoleInstance.Id, RoleEnvironment.DeploymentId, ex.Message, ex.StackTrace);
                throw ex;
            }
        }