Ejemplo n.º 1
0
        private static HttpConfiguration GetHttpConfiguration()
        {
            var config = new HttpConfiguration();

            FormatterConfig.ConfigureFormatters(config.Formatters);
            config.MapHttpAttributeRoutes();
            config = RegisterDependencys(config);
            return(config);
        }
Ejemplo n.º 2
0
        public void Configuration(IAppBuilder appBuilder)
        {
            HttpConfiguration config = new HttpConfiguration();

            PhysicalFileSystem physicalFileSystem = new PhysicalFileSystem(@".\wwwroot");
            FileServerOptions  fileOptions        = new FileServerOptions();

            fileOptions.EnableDefaultFiles = true;
            fileOptions.RequestPath        = PathString.Empty;
            fileOptions.FileSystem         = physicalFileSystem;
            fileOptions.DefaultFilesOptions.DefaultFileNames    = new[] { "index.html" };
            fileOptions.StaticFileOptions.FileSystem            = fileOptions.FileSystem = physicalFileSystem;
            fileOptions.StaticFileOptions.ServeUnknownFileTypes = true;
            fileOptions.EnableDirectoryBrowsing = true;

            FormatterConfig.ConfigureFormatters(config.Formatters);
            config.MapHttpAttributeRoutes();

            appBuilder.UseWebApi(config);
            appBuilder.UseFileServer(fileOptions);
        }