-
This commit is contained in:
@@ -19,20 +19,23 @@ builder.Services.AddScoped<DemoDataService>();
|
||||
builder.Services.AddScoped<ReportGeneratorService>();
|
||||
builder.Services.AddSingleton<DataNotificationService>();
|
||||
|
||||
// SignalR
|
||||
builder.Services.AddSignalR()
|
||||
// SignalR - with increased message size for template sync (default is 32KB)
|
||||
builder.Services.AddSignalR(options =>
|
||||
{
|
||||
options.MaximumReceiveMessageSize = 1024 * 1024; // 1MB max message size
|
||||
})
|
||||
.AddJsonProtocol(options =>
|
||||
{
|
||||
options.PayloadSerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles;
|
||||
options.PayloadSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull;
|
||||
});
|
||||
|
||||
// CORS - Allow credentials for SignalR
|
||||
// CORS - Allow credentials for SignalR (accepts any origin for external access)
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy("AllowFrontend", policy =>
|
||||
{
|
||||
policy.SetIsOriginAllowed(origin => new Uri(origin).Host == "localhost")
|
||||
policy.SetIsOriginAllowed(_ => true) // Permette qualsiasi origine
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod()
|
||||
.AllowCredentials();
|
||||
|
||||
Reference in New Issue
Block a user