Пример #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app,
                              IHostingEnvironment env,
                              ILoggerFactory loggerFactory,
                              IAuthenticationService authService,
                              IScriptFactoryService scriptFactoryService)
        {
            var globalConfig = Configuration.GetSection("Global");

            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            if (globalConfig.GetValue("UseLogFiles", true))
            {
                loggerFactory.AddNLog();
                env.ConfigureNLog("nlog.config");
            }

            scriptFactoryService.Configure(Configuration.GetSection("ScriptFactory"));
            scriptFactoryService.Init();

            app.UseScribiAuth();

            app.UseCors(options =>
            {
                options.AllowAnyHeader();
                options.AllowAnyMethod();
                options.AllowAnyOrigin();
                options.AllowCredentials();
            });

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            if (globalConfig.GetValue("UseSignalR", true))
            {
                if (globalConfig.GetValue("UseWebSockets", true))
                {
                    app.UseWebSockets();
                }
                app.UseSignalR();
            }

            app.UseMvc();

            if (globalConfig.GetValue("UseSwagger", true))
            {
                app.UseSwagger();
                app.UseSwaggerUi();
            }
        }
Пример #2
0
 public FrontendController(IScriptFactoryService scriptFactory)
 {
     _scriptFactory = scriptFactory;
 }