示例#1
0
        // register Middlewares 注册中间件,路由,日志,异常处理等
        static void RegisterMiddlewares(IWebServerBuilder builder)
        {
            builder.UnhandledException(new ResourceNotFoundExceptionHandler());
            builder.Use(new SessionManager());
            builder.Use(new Httplog());
            builder.Use(new Filter());
            var route = new Routing();

            RegisterRoutes(route);
            builder.Use(route);
            builder.Use(new Http404());
        }
示例#2
0
        static void RegisterMiddlewares(IWebServerBuilder builder)
        {
            builder.Use(new HttpLog());
            // builder.Use(new BlockIp("::1", "127.0.0.1"));
            builder.Use(new SessionManager());
            builder.Use(new BodyParser());
            builder.Use(new Authentication());

            var routes = new Routing();

            RegisterRoutes(routes);
            builder.Use(routes);

            builder.Use(new StaticFile());
            builder.Use(new Http404());

            builder.UnhandledException(new Http500());
        }