tcc/ASP.NET/Program.cs

34 lines
948 B
C#
Raw Normal View History

2023-08-20 20:21:58 +00:00
using Microsoft.AspNetCore.Server.Kestrel.Core;
2023-08-29 18:55:28 +00:00
using Microsoft.Extensions.FileProviders;
2023-08-16 18:58:01 +00:00
using TCC.Services;
namespace TCC
2023-08-16 18:40:27 +00:00
{
public class Program
{
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
2023-08-16 18:58:01 +00:00
builder.Services.AddScoped<ImageService>();
2023-08-16 18:40:27 +00:00
builder.Services.AddControllers();
2023-08-20 20:21:58 +00:00
builder.Services.Configure<KestrelServerOptions>(options =>
{
options.Limits.MaxRequestBodySize = int.MaxValue; // if don't set default value is: 30 MB
});
2023-08-16 18:40:27 +00:00
var app = builder.Build();
2023-08-29 18:55:28 +00:00
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(Path.Combine(builder.Environment.ContentRootPath, "static")),
RequestPath = "/static"
});
2023-08-16 18:40:27 +00:00
app.MapControllers();
app.Run();
}
}
}