From 8dadbc5370aeb56d88044609da49a99b4d345843 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Wed, 25 Mar 2026 09:32:40 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=A2=9E=E5=8A=A0=E5=AF=86?= =?UTF-8?q?=E9=92=A5=E5=BA=8F=E5=88=97=E5=8C=96=E8=87=AA=E5=8A=A8=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8D=E5=AF=86=E9=92=A5?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extensions/ServiceCollectionSharedExtensions.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/BootstrapBlazor.Server/Extensions/ServiceCollectionSharedExtensions.cs b/src/BootstrapBlazor.Server/Extensions/ServiceCollectionSharedExtensions.cs index 8ccfc498c9c..7ec51c95296 100644 --- a/src/BootstrapBlazor.Server/Extensions/ServiceCollectionSharedExtensions.cs +++ b/src/BootstrapBlazor.Server/Extensions/ServiceCollectionSharedExtensions.cs @@ -4,6 +4,7 @@ // Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.DataProtection; namespace Microsoft.Extensions.DependencyInjection; @@ -98,7 +99,9 @@ public static IServiceCollection AddBootstrapBlazorServices(this IServiceCollect services.AddBootstrapBlazorRegionService(); // 增加密钥存储配置 - services.AddDataProtection(); + services.AddDataProtection() + .SetApplicationName("BootstrapBlazor") + .PersistKeysToFileSystem(new DirectoryInfo(Path.Combine(AppContext.BaseDirectory, "keys"))); // 增加 PetaPoco ORM 数据服务操作类 // 需要时打开下面代码