AddResponseCompression...

This commit is contained in:
jozsef.b@aycode.com 2024-05-30 12:49:29 +02:00
parent ddb1ce58a4
commit 767a5b20fc
3 changed files with 29 additions and 26 deletions

View File

@ -308,13 +308,12 @@
Company resultCompany = null; Company resultCompany = null;
if (e.IsNew) if (e.IsNew)
{ {
//add new orderData to orderData array _logger.Info("New company adding");
_logger.Info("New orderData added");
resultCompany = await serviceProviderDataService.CreateServiceProviderAsync((Company)e.EditModel); resultCompany = await serviceProviderDataService.CreateServiceProviderAsync((Company)e.EditModel);
} }
else else
{ {
_logger.Info("orderData updated at id " + ((Company)e.EditModel).Id); _logger.Info("company updating at id " + ((Company)e.EditModel).Id);
resultCompany = await serviceProviderDataService.UpdateServiceProviderAsync((Company)e.EditModel); resultCompany = await serviceProviderDataService.UpdateServiceProviderAsync((Company)e.EditModel);

View File

@ -148,22 +148,16 @@ builder.WebHost.ConfigureKestrel((context, options) =>
}); });
}); });
//builder.Services.AddResponseCompression(options => builder.Services.AddResponseCompression(options =>
//{ {
// options.EnableForHttps = true; options.EnableForHttps = true;
// options.Providers.Add<BrotliCompressionProvider>(); options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(new[] { "application/octet-stream" });
// options.Providers.Add<GzipCompressionProvider>(); options.Providers.Add<BrotliCompressionProvider>();
//}); options.Providers.Add<GzipCompressionProvider>();
});
//builder.Services.Configure<BrotliCompressionProviderOptions>(options => builder.Services.Configure<BrotliCompressionProviderOptions>(options => options.Level = CompressionLevel.Optimal);
//{ builder.Services.Configure<GzipCompressionProviderOptions>(options => options.Level = CompressionLevel.Optimal);
// options.Level = CompressionLevel.Optimal;
//});
//builder.Services.Configure<GzipCompressionProviderOptions>(options =>
//{
// options.Level = CompressionLevel.Optimal;
//});
var app = builder.Build(); var app = builder.Build();
@ -178,6 +172,11 @@ else
app.UseHsts(); app.UseHsts();
} }
//if (!app.Environment.IsDevelopment())
{
app.UseResponseCompression();
}
app.UseSwagger(); app.UseSwagger();
app.UseSwaggerUI(c => app.UseSwaggerUI(c =>
{ {
@ -197,11 +196,6 @@ app.MapRazorPages();
app.MapControllers(); app.MapControllers();
app.MapBlazorHub(); app.MapBlazorHub();
//if (!app.Environment.IsDevelopment())
{
//app.UseResponseCompression();
}
app.MapHub<SignalRHub>("/TiamChatHub"); app.MapHub<SignalRHub>("/TiamChatHub");
app.MapHub<LoggerSignalRHub>("/TiamLoggerHub"); app.MapHub<LoggerSignalRHub>("/TiamLoggerHub");
app.MapHub<DevAdminSignalRHub>("/DevAdminHub"); app.MapHub<DevAdminSignalRHub>("/DevAdminHub");

View File

@ -41,7 +41,12 @@ namespace TIAMWebApp.Shared.Application.Services
HubConnection = new HubConnectionBuilder() HubConnection = new HubConnectionBuilder()
.WithUrl($"{Setting.BaseUrl}/{hubName}") .WithUrl($"{Setting.BaseUrl}/{hubName}")
//.AddMessagePackProtocol(options => options.SerializerOptions = MessagePackSerializerOptions.Standard.WithSecurity(MessagePackSecurity.UntrustedData)) //.AddMessagePackProtocol(options => {
// options.SerializerOptions = MessagePackSerializerOptions.Standard
// .WithResolver(MessagePack.Resolvers.StandardResolver.Instance)
// .WithSecurity(MessagePackSecurity.UntrustedData)
// .WithCompression(MessagePackCompression.Lz4Block)
// .WithCompressionMinLength(256);})
.Build(); .Build();
HubConnection.Closed += HubConnection_Closed; HubConnection.Closed += HubConnection_Closed;
@ -131,8 +136,13 @@ namespace TIAMWebApp.Shared.Application.Services
{ {
if (responseMessage.Status == SignalResponseStatus.Error || responseMessage.ResponseData == null) if (responseMessage.Status == SignalResponseStatus.Error || responseMessage.ResponseData == null)
{ {
Logger.Error($"Client SendMessageToServerAsync<TResponseData> response error; await; tag: {messageTag}; Status: {responseMessage.Status}; requestId: {requestId};"); var errorText = $"Client SendMessageToServerAsync<TResponseData> response error; await; tag: {messageTag}; Status: {responseMessage.Status}; requestId: {requestId};";
return default;
Logger.Error(errorText);
//TODO: Ideiglenes, majd a ResponseMessage-et kell visszaadni a Status miatt! - J.
throw new Exception(errorText);
//return default;
} }
return responseMessage.ResponseData.JsonTo<TResponse>(); return responseMessage.ResponseData.JsonTo<TResponse>();