42 lines
1.1 KiB
C#
42 lines
1.1 KiB
C#
using System;
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.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, IHostingEnvironment host)
|
|
{
|
|
Console.WriteLine("webroot: " + host.WebRootPath);
|
|
|
|
// Displays all log levels
|
|
factory.AddConsole(LogLevel.Debug);
|
|
|
|
app.UseFileServer(new FileServerOptions
|
|
{
|
|
EnableDirectoryBrowsing = true
|
|
});
|
|
}
|
|
|
|
public static void Main(string[] args)
|
|
{
|
|
var host = new WebHostBuilder()
|
|
.UseDefaultHostingConfiguration(args)
|
|
.UseKestrel()
|
|
.UseIISPlatformHandlerUrl()
|
|
.UseStartup<Startup>()
|
|
.Build();
|
|
|
|
host.Run();
|
|
}
|
|
}
|
|
}
|