コード例 #1
0
        public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime lifetime)
        {
            // Call Back
            BeforeConfigureApp?.Invoke(app, env, lifetime);

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

            // Cors
            app.UseElectCors();

            // Http Context
            app.UseElectHttpContext();

            // Service Measure
            app.UseElectMeasureProcessingTime();

            // Server Info
            app.UseElectServerInfo();

            // Response Compress
            app.UseResponseCompression();

            // API Doc - Swagger
            app.UseElectSwagger();

            // Health Check
            app.UseElectHealthCheck();

            // Background Job - Hangfire
            app.UseElectHangfire();

            // Static Files
            app.UseStaticFiles();

            // MVC
            BeforeUseMvc?.Invoke(app, env, lifetime);

            app.UseMvcWithDefaultRoute();

            AfterUseMvc?.Invoke(app, env, lifetime);

            // Call Back
            AfterConfigureApp?.Invoke(app, env, lifetime);
        }
コード例 #2
0
        public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime lifetime)
        {
            // Call Back
            BeforeConfigureApp?.Invoke(app, env, lifetime);

            // Blazor Metadata Render Middleware (Keep on the top / first Middleware)
            app.UseHeadElementServerPrerendering();

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

            // Http Context
            app.UseElectHttpContext();

            // Service Measure
            app.UseElectMeasureProcessingTime();

            // Server Info
            app.UseElectServerInfo();

            // Response Compress
            app.UseResponseCompression();

            // Static Files

            app.UseStaticFiles();

            // Blazor

            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapBlazorHub();
                endpoints.MapFallbackToPage("/_Host");
            });

            // Call Back
            AfterConfigureApp?.Invoke(app, env, lifetime);
        }