Esempio n. 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)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
                app.UseExceptionHandler("/Shared/Error");
            }

            app.UseCors(builder =>
            {
                //builder.WithOrigins("http://localhost:55811").AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod();
                builder.AllowAnyOrigin();
                builder.AllowAnyHeader();
                builder.AllowAnyMethod();
                builder.AllowCredentials();
            });
            app.UseStaticHttpContext();
            OpenConfiguration.Configure(Configuration);



            app.UseSession();

            app.UseHttpsRedirection();

            //异常中间件
            // app.UseMiddleware(typeof(ErrorHandlingMiddleware));
            app.UseSwagger();

            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v2/swagger.json", "OneTest API V1");
                c.ShowRequestHeaders();
            });


            //app.UseAuthentication();


            app.UseIocConfiguration();


            app.UseResponseCompression();

            app.UseMvc();

            app.UseSignalR(routes =>
            {
                routes.MapHub <ChatHub>("/chatHub");
            });
            app.UseSignalR(routes =>
            {
                routes.MapHub <ChatHubNew>("/ChatHubNew");
            });
        }
Esempio n. 2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();
            OpenConfiguration.Configure(Configuration);
            //app.UseMvc(routes =>
            //{
            //    routes.MapRoute(
            //        name: "default",
            //        template: "{controller=Home}/{action=Index}/{id?}");
            //});

            var logic = (IUserLogic)app.ApplicationServices.GetService(typeof(IUserLogic));

            var list = logic.GetAll();

            var apiList = new List <string>()
            {
                "One",
                "Two"
            };

            app.UseSwagger(c =>
            {
                c.RouteTemplate = "/{documentName}/swagger.json";
            });
            app.UseSwaggerUI(c =>
            {
                apiList.ForEach(apiItem =>
                {
                    c.SwaggerEndpoint($"/{apiItem}/{apiItem}/swagger.json", apiItem);
                });
                c.ShowRequestHeaders();
            });

            app.UseOcelot().Wait();
        }
Esempio n. 3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
                app.UseExceptionHandler("/Shared/Error");
            }

            //app.ApplicationServices.GetService

            app.UseCors(builder =>
            {
                builder.AllowAnyOrigin();
                builder.AllowAnyHeader();
                builder.AllowAnyMethod();
            });
            app.UseStaticHttpContext();
            OpenConfiguration.Configure(Configuration);


            app.UseSession();

            app.UseHttpsRedirection();

            //异常中间件
            app.UseMiddleware(typeof(ErrorHandlingMiddleware));
            app.UseSwagger();

            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v2/swagger.json", "OneTest API V1");
                c.ShowRequestHeaders();
            });


            app.UseMvc();
        }
Esempio n. 4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseBrowserLink();
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseCors(builder =>
            {
                builder.AllowAnyOrigin();
                builder.AllowAnyHeader();
                builder.AllowAnyMethod();
            });
            app.UseStaticHttpContext();
            OpenConfiguration.Configure(Configuration);


            app.UseSession();

            app.UseHttpsRedirection();

            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            app.UseSignalR(routes =>
            {
                routes.MapHub <ChatHub>("/chatHub");
            });
        }