36 lines
968 B
C#
36 lines
968 B
C#
using Microsoft.AspNet.Builder;
|
|
using Microsoft.AspNet.Hosting;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace StaticFilesSample
|
|
{
|
|
public class Startup
|
|
{
|
|
public void ConfigureServices(IServiceCollection services)
|
|
{
|
|
services.AddDirectoryBrowser();
|
|
}
|
|
|
|
public void Configure(IApplicationBuilder app, ILoggerFactory factory)
|
|
{
|
|
// Displays all log levels
|
|
factory.AddConsole(LogLevel.Debug);
|
|
|
|
app.UseFileServer(new FileServerOptions
|
|
{
|
|
EnableDirectoryBrowsing = true
|
|
});
|
|
}
|
|
|
|
public static void Main(string[] args)
|
|
{
|
|
var application = new WebApplicationBuilder()
|
|
.UseConfiguration(WebApplicationConfiguration.GetDefault(args))
|
|
.UseStartup<Startup>()
|
|
.Build();
|
|
|
|
application.Run();
|
|
}
|
|
}
|
|
} |