예제 #1
0
        public void Configuration(IAppBuilder appBuilder)
        {
            System.Net.ServicePointManager.DefaultConnectionLimit = 256;

            HttpConfiguration config = new HttpConfiguration();

            FormatterConfig.ConfigureFormatters(config.Formatters);

            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;

            config.MapHttpAttributeRoutes();

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