예제 #1
0
        public void Configuration(IAppBuilder appBuilder)
        {
            HttpConfiguration httpConfiguration = new HttpConfiguration();

            httpConfiguration.EnableCors(new EnableCorsAttribute("*", "*", "*"));
            httpConfiguration.MapHttpAttributeRoutes();
            httpConfiguration.Routes.MapHttpRoute("WeChatApi", "api/{controller}/{id}", new
            {
                id = RouteParameter.Optional
            });
            httpConfiguration.EnableSwagger(delegate(SwaggerDocsConfig c)
            {
                c.SingleApiVersion("v1", "WebAPI");
                c.IncludeXmlComments(GetXmlCommentsPath());
                c.ResolveConflictingActions((IEnumerable <ApiDescription> x) => x.First());
            }).EnableSwaggerUi();
            appBuilder.UseWebApi(httpConfiguration);
            //Auth.Init();
            XzyWebSocket.Init();
        }
예제 #2
0
        public void Configuration(IAppBuilder appBuilder)
        {
            HttpConfiguration config = new HttpConfiguration();

            //跨域配置
            config.EnableCors(new EnableCorsAttribute("*", "*", "*"));
            config.MapHttpAttributeRoutes();
            config.Routes.MapHttpRoute(name: "WeChatApi",
                                       routeTemplate: "api/{controller}/{id}",
                                       defaults: new { id = RouteParameter.Optional }
                                       );
            config.EnableSwagger(c =>
            {
                c.SingleApiVersion("v1", "WebAPI");
                c.IncludeXmlComments(GetXmlCommentsPath());
                c.ResolveConflictingActions(x => x.First());
            }).EnableSwaggerUi();

            appBuilder.UseWebApi(config);
            Auth.Init();
            XzyWebSocket.Init();
        }