private static HttpConfiguration GetHttpConfiguration() { var config = new HttpConfiguration(); FormatterConfig.ConfigureFormatters(config.Formatters); config.MapHttpAttributeRoutes(); config = RegisterDependencys(config); return(config); }
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); }