Goal: https://localhost:44320/api/auth should be the app’s base URL. Key rule: When you use app.UsePathBase("/api/auth"), every incoming request path and every generated URL must include /api/auth.
Apply these steps to your HttpApi.Host:
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
app.UsePathBase("/api/auth");
app.UseRouting();
app.UseStaticFiles();
app.UseAbpStudioLink();
app.UseAbpSecurityHeaders();
app.UseCors();
app.UseAuthentication();
if (MultiTenancyConsts.IsEnabled)
{
app.UseMultiTenancy();
}
app.UseUnitOfWork();
app.UseDynamicClaims();
app.UseAuthorization();
app.UseSwagger();
app.UseAbpSwaggerUI(options =>
{
// Swagger endpoint MUST include the PathBase prefix
options.SwaggerEndpoint("/api/auth/swagger/v1/swagger.json", "API");
// And make Swagger UI itself available under /api/auth/swagger
options.RoutePrefix = "api/auth/swagger";
});
app.UseConfiguredEndpoints();
}
{
"App": {
"SelfUrl": "https://localhost:44320/api/auth"
}
}
ABP uses App:SelfUrl for various generated links. If you keep it without the prefix, some URLs will be wrong.
Keep controller routes as-is You do NOT need to change [Route("api/...")] attributes or conventional controller prefixes. PathBase sits in front of the entire app, so /api/auth/api/values would be wrong. Correct request is /api/auth/api/values, which is “/api/auth” (PathBase) + “/api/values” (your controller route). Don’t double-prefix routes.
Swagger JSON endpoint path With PathBase, the JSON is served at /api/auth/swagger/v1/swagger.json. Ensure:
Anti-forgery and ABP Swagger UI script ABP’s Swagger integration injects abp.js to handle CSRF. With PathBase, the SetCsrfCookie endpoint will resolve correctly as long as App:SelfUrl and PathBase are consistent and the Swagger UI page is under the same PathBase.
If you also expose static assets under the same site Call app.UseStaticFiles() after UsePathBase so static files are served via /api/auth/… when requested from this host.
Common pitfalls that cause 404 in Swagger:
Optional (only if you must run the UI at root /swagger while API is under /api/auth):
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
Where to see logs during development
How to confirm or change the file location
Increasing verbosity to capture errors
Production recommendations
Quick checklist
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
Where to run the command
The command to use (Angular)
Prerequisites and configuration that affect detection
Forcing regeneration or when new endpoints are not detected
Notes for reliable results
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
A) Always run migrations + seed via DbMigrator first
B) Verify the connection string used by all processes
C) Ensure seeding is invoked if you rely on hosts (not only DbMigrator)
public override async Task OnApplicationInitializationAsync(ApplicationInitializationContext context)
{
var seeder = context.ServiceProvider.GetRequiredService<IDataSeeder>();
await seeder.SeedAsync(); // idempotent; safe to call
}
D) Confirm your IDataSeedContributor discovery
public class MyDataSeedContributor : IDataSeedContributor, ITransientDependency
{
public async Task SeedAsync(DataSeedContext context)
{
// idempotent seeding
}
}
E) Check OpenIddict client seeding inputs
F) Ensure migrations include all module tables
G) Swagger/Angular UI missing on API
app.UseAbpSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "My API");
});
H) Make seeding resilient and repeatable
I) Quick local recovery steps
This approach aligns with common ABP conventions, but specific official documentation for every point in this exact scenario is not available.
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
Apply the checklist below exactly in this order:
Trust and use HTTPS dev certificate
Ensure the HttpApiHost really runs and listens
Fix ports in Angular environment
Enable CORS for Angular origin
Use HTTPS in Angular OAuth config
Clear stale Angular dev state
Confirm application-configuration endpoint manually
Most common root causes for exactly this symptom:
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
[DependsOn(/* ... */)]
public class QRSPCBaseSetServiceDomainSharedModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Add<BaseSetServiceResource>("en")
.AddBaseTypes(typeof(AbpValidationResource))
.AddVirtualJson("/Localization/BaseSetService"); // folder with zh-Hans.json etc.
});
}
}
3) The gateway routes /api/abp/application-localization to Administration and no cache inconsistency exists (see next).
4) If dynamic localization is enabled, ensure the Language Management DB contains the resource (initial registration occurs on first start of the resource-owning service). Restarting the service re-registers resources if needed.
Caching considerations for intermittent missing resources
Why the page returns to Home every ~45 minutes
Diagnostics checklist
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
What you see is expected. When you create an ABP application with Angular UI, the CLI generates:
Those “layers” are the standard ABP solution structure for a modular, maintainable backend. The Angular app consumes the backend APIs from the HttpApi.Host. Even if you don’t touch each C# project directly, they are required for a functional backend and for features like permissions, auditing, data seeding, migrations, etc.
If you want only an Angular front-end without ABP backend projects:
Summary of recommended commands:
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
Do this:
Add Elsa v3 EF packages to the Host (the app that will expose Elsa endpoints):
Configure Elsa in the Host
using Elsa.EntityFrameworkCore;
using Elsa.EntityFrameworkCore.Extensions;
using Microsoft.EntityFrameworkCore;
[DependsOn(
typeof(Volo.Elsa.Abp.AspNetCore.AbpElsaAspNetCoreModule),
typeof(Volo.Elsa.Abp.Identity.AbpElsaIdentityModule),
typeof(Volo.Elsa.Abp.Application.AbpElsaApplicationModule),
typeof(Volo.Elsa.Abp.Application.Contracts.AbpElsaApplicationContractsModule)
)]
public class MyProjectHttpApiHostModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
var cs = configuration.GetConnectionString("Default");
context.Services
.AddElsa(elsa => elsa
.UseEntityFrameworkCorePersistence(ef => ef.UseSqlServer(cs))
.UseWorkflowManagement()
.UseWorkflowRuntime(runtime => runtime.UseEntityFrameworkCore(ef => ef.UseSqlServer(cs)))
.UseScheduling()
.UseJavaScript()
.UseHttp(http => configuration.GetSection("Elsa:Http").Bind(http))
.UseWorkflowsApi());
context.Services.AddElsaApiEndpoints();
Configure<AbpAntiForgeryOptions>(o =>
{
// Exclude Elsa API
o.AutoValidateFilter = t => t.Assembly != typeof(Elsa.Server.Api.Endpoints.WorkflowRegistry.Get).Assembly;
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
app.UseHttpActivities();
app.UseConfiguredEndpoints();
}
}
using Elsa.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration;
public class ElsaContextFactory : IDesignTimeDbContextFactory<ElsaContext>
{
public ElsaContext CreateDbContext(string[] args)
{
var cfg = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", optional: true)
.AddJsonFile("appsettings.Development.json", optional: true)
.AddEnvironmentVariables()
.Build();
var options = new DbContextOptionsBuilder<ElsaContext>()
.UseSqlServer(cfg.GetConnectionString("Default"))
.Options;
return new ElsaContext(options);
}
}
Create migrations for Elsa’s DbContext (not your app DbContext):
Apply in ABP way (recommended):
Will the Host act as Elsa Server?
Production readiness status
Microservice note (if applicable)
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
Do this in your host (the application that will expose Elsa endpoints):
Packages (NuGet)
Configure Elsa EF Core persistence In your Host module’s ConfigureServices:
using Elsa.EntityFrameworkCore.Extensions;
using Elsa.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
public override void ConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
context.Services
.AddElsa(elsa =>
{
elsa
.UseEntityFrameworkCorePersistence(ef =>
ef.UseSqlServer(configuration.GetConnectionString("Default")))
.AddHttpActivities()
.AddQuartzTemporalActivities();
});
context.Services.AddElsaApiEndpoints();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
app.UseHttpActivities();
app.UseConfiguredEndpoints();
}
using Elsa.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration;
public class ElsaContextFactory : IDesignTimeDbContextFactory<ElsaContext>
{
public ElsaContext CreateDbContext(string[] args)
{
var config = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", optional: false)
.AddEnvironmentVariables()
.Build();
var options = new DbContextOptionsBuilder<ElsaContext>()
.UseSqlServer(config.GetConnectionString("Default"))
.Options;
return new ElsaContext(options);
}
}
Clean bin/obj and ensure the project builds before adding the migration.
Will your Host act as “Elsa Server”?
Production readiness
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.