Пример #1
0
        public void Configuration(IAppBuilder app)
        {
            var configuration = new HttpConfiguration();

            configuration.MapHttpAttributeRoutes();
            configuration.EnsureInitialized();
            configuration.Formatters.JsonFormatter.SerializerSettings = new JsonSerializerSettings()
            {
                ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor
            };
            LinkyConfiguration.Configure(configuration);
            app.UseWebApi(configuration);

            app.UseDefaultFiles(new DefaultFilesOptions()
            {
                DefaultFileNames = new[] { "index.html" }
            });
            app.UseFileServer(new FileServerOptions()
            {
                FileSystem         = new PhysicalFileSystem(@".\content"),
                RequestPath        = PathString.Empty,
                EnableDefaultFiles = true
            });

            app.Run((context) =>
            {
                var task = context.Response.WriteAsync("Hello world!");
                return(task);
            });
        }
Пример #2
0
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services

            // Web API routes
            config.MapHttpAttributeRoutes();

            LinkyConfiguration.Configure(config);
        }