Missing DataProtection (Redis) Configuration in HostWithIds Template
Is there an existing issue for this?
- [x] I have searched the existing issues
Description
I've encountered an issue while configuring DataProtection in our project structure. When inspecting the DataProtection setup across our application templates, I noticed a discrepancy with the HostWithIds template.
Background
In our solution, we use DataProtection with Redis for key persistence in production environments. This configuration is consistently implemented in most of our host templates.
Observations
-
The AuthServer, HttpApi.Host, and Web.Host templates all include the "Microsoft.AspNetCore.DataProtection.StackExchangeRedis" package reference in their .csproj files.
-
These templates also have consistent service registration for DataProtection, following this pattern:
private void ConfigureDataProtection(
ServiceConfigurationContext context,
IConfiguration configuration,
IWebHostEnvironment hostingEnvironment)
{
var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("MyProjectName");
if (!hostingEnvironment.IsDevelopment())
{
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!);
dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys");
}
}
However, when examining the HostWithIds template, I found:
- No reference to "Microsoft.AspNetCore.DataProtection.StackExchangeRedis" in its .csproj file
- No implementation of the ConfigureDataProtection method or equivalent DataProtection setup
- No matches for HostWithIds when searching relevant keywords, as shown in the graph below
Question
Is this an intentional omission because the DataProtection configuration for HostWithIds is handled in a different package/dependency? Or is this a configuration gap that needs to be addressed by adding the missing package reference and service registration?
https://github.com/abpframework/abp/blob/dev/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj
Reproduction Steps
No response
Expected behavior
No response
Actual behavior
No response
Regression?
No response
Known Workarounds
No response
Version
9.2.4
User Interface
Blazor
Database Provider
EF Core (Default)
Tiered or separate authentication server
Tiered
Operation System
Windows (Default)
Other information
No response
hi @ViatorLife
The template projects are no longer maintained.
You can use Studio to create a new project.
https://abp.io/studio
@maliming
I have tried using both Abp Studio and Abp CLI, and found that this part of the configuration is missing in the created templates.
The same options were used:
- Template: App
- UI Framework: No-UI or Blazor
- Separate Authentication Server: false (I am using the Community Edition)
abp new Acme.BookStore1 --template app --mobile none --ui-framework no-ui --database-provider ef --create-solution-folder --theme basic --database-management-system MySQL --connection-string ""
The results obtained are the same—this configuration is missing in both cases.
In the solution generated by Abp Studio
In the solution generated by Abp CLI
Although the name uses "HttpApi.Host", when compared with the source code of the templates, it corresponds to the "HostWithIds" template being used.
Thanks. I will check the Studio templates.
hi
I checked. The tiered or CMSKit project created by Studio/CLI is no problem.
Thanks.