Files
exceltopdf-service/Program.cs
T
huanld cecde2bc1c feat: standalone ExcelToPdfService - ASP.NET Core 8 + Syncfusion
- Services/ExcelToPdfService.cs: core conversion logic (XlsIORenderer)
- Controllers/ExcelToPdfController.cs: REST API endpoints
  * POST /api/ExcelToPdf/convert (file upload)
  * POST /api/ExcelToPdf/convert-by-path (server path)
  * GET  /api/ExcelToPdf/health
- Program.cs: minimal API setup, 50MB upload limit
- appsettings.json: port 5200, Syncfusion license
- Syncfusion 21.1.37 (XlsIO + Pdf + XlsIORenderer)
- Binary signed: Azure Trusted Signing (Private Trust)
2026-05-18 15:05:10 +07:00

31 lines
834 B
C#

using ExcelToPdfService.Services;
using Syncfusion.Licensing;
var builder = WebApplication.CreateBuilder(args);
// Syncfusion license
SyncfusionLicenseProvider.RegisterLicense(
builder.Configuration["Syncfusion:LicenseKey"]
?? "MjExMDkzMEAzMjMxMmUzMTJlMzMzNWd1RGM1NVFmUUMzWmZlN0dCc3NadUJyM1RUYVh1SHVSS1B2Tzdwa0NhcE09");
// Services
builder.Services.AddControllers();
builder.Services.AddScoped<IExcelToPdfService, ExcelToPdfService.Services.ExcelToPdfService>();
// Allow large file uploads (50 MB)
builder.Services.Configure<Microsoft.AspNetCore.Http.Features.FormOptions>(o =>
{
o.MultipartBodyLengthLimit = 50 * 1024 * 1024;
});
builder.WebHost.ConfigureKestrel(o =>
{
o.Limits.MaxRequestBodySize = 50 * 1024 * 1024;
});
var app = builder.Build();
app.UseHttpsRedirection();
app.MapControllers();
app.Run();