To implement an ICurrentCompany service similar to ICurrentTenant in a layered Blazor WASM solution, you can follow these steps:
public interface ICurrentCompany
{
Guid? CompanyId { get; }
string CompanyCode { get; }
Task ChangeAsync(Guid companyId, string companyCode);
}
Implement the Service:
Example implementation for Blazor WASM (client-side):
public class CurrentCompany : ICurrentCompany
{
private readonly IJSRuntime _jsRuntime;
private const string CompanyCookieName = "CurrentCompany";
public Guid? CompanyId { get; private set; }
public string CompanyCode { get; private set; }
public CurrentCompany(IJSRuntime jsRuntime)
{
_jsRuntime = jsRuntime;
}
public async Task ChangeAsync(Guid companyId, string companyCode)
{
CompanyId = companyId;
CompanyCode = companyCode;
await _jsRuntime.InvokeVoidAsync("BlazorCookies.Set", CompanyCookieName, companyId.ToString());
// Optionally store companyCode as well
}
public async Task InitializeAsync()
{
var companyIdString = await _jsRuntime.InvokeAsync<string>("BlazorCookies.Get", CompanyCookieName);
if (Guid.TryParse(companyIdString, out var companyId))
{
CompanyId = companyId;
}
}
}
builder.Services.AddScoped<ICurrentCompany, CurrentCompany>();
Set the Company from the UI:
ChangeAsync on your ICurrentCompany service.Server-Side:
Data Filtering:
public interface ICompanyFilter
{
Guid? CompanyId { get; }
}
- Apply this filter to your entities and queries.
References for Custom Filters and Claims:
This approach aligns with ABP conventions for context services and data filtering, allowing you to change the current company at runtime and persist the selection in a cookie, similar to how tenants are managed.
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.
The error The entity type 'ExtraPropertyDictionary' requires a primary key to be defined typically occurs when a type that is not meant to be an EF Core entity is being picked up by your DbContext's model builder. ExtraPropertyDictionary is an internal type used by ABP for extra properties and should not be mapped as an entity.
This usually happens if you accidentally add a DbSet<ExtraPropertyDictionary> to your DbContext, or if you use modelBuilder.Entity<ExtraPropertyDictionary>() in your OnModelCreating method. EF Core tries to map it as a table, but it has no primary key, causing the error.
Solution Steps:
Check Your DbContext:
DbSet<ExtraPropertyDictionary> in your DbContext.modelBuilder.Entity<ExtraPropertyDictionary>() in OnModelCreating.Review Entity Extension Mappings:
ExtraPropertyDictionary.Clean and Rebuild:
Check for Accidental Usages:
ExtraPropertyDictionary in your entity or DbContext code.If You Need to Add Extra Properties:
Example for extending an entity (do NOT use ExtraPropertyDictionary directly):
ObjectExtensionManager.Instance.Modules()
.ConfigureIdentity(identity =>
{
identity.ConfigureUser(user =>
{
user.AddOrUpdateProperty<string>("CustomProperty");
});
});
References:
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.
To refresh the access token using a refresh token in a Blazor Server application with ABP, follow these steps:
options.Scope.Add("offline_access");
.AddCookie("Cookies", options =>
{
options.ExpireTimeSpan = TimeSpan.FromDays(365); // Example: 1 year
})
Handle token expiration and refresh:
Sign out users after token expiration (optional but recommended):
Example: Adding offline_access and configuring OpenIdConnect in Blazor Server
services.AddAuthentication(options =>
{
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
})
.AddCookie("Cookies", options =>
{
options.ExpireTimeSpan = TimeSpan.FromDays(365);
})
.AddOpenIdConnect(options =>
{
// ... other options ...
options.Scope.Add("offline_access");
});
var response = await httpClient.RequestRefreshTokenAsync(new RefreshTokenRequest
{
Address = disco.TokenEndpoint,
ClientId = "your-client-id",
ClientSecret = "your-client-secret",
RefreshToken = "your-refresh-token"
});
For a complete example and more details, see the official ABP documentation and community articles below.
Sources:
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 error (Value cannot be null. (Parameter 'path')) during the "ApplicationObjectMappingCommand" step in ABP Suite CRUD generation is a known issue, especially in microservice or modular solutions. It typically occurs when ABP Suite cannot find or resolve the expected file path for the Application layer's AutoMapper profile or related mapping files.
Check Application Layer Structure
YourModuleApplicationAutoMapperProfile.cs) in the correct folder (usually under Application or Application.Contracts)..csproj and not excluded or missing.Verify File Paths in Suite Configuration
Check for Multiple or Missing *DbContextModelCreatingExtensions.cs Files
*DbContextModelCreatingExtensions.cs file in your module can confuse Suite. Keep only one such file per module and move all configuration methods into it.Regenerate or Restore Missing Files
*ApplicationAutoMapperProfile.cs*DbContextModelCreatingExtensions.cs
public class TenantDomainApplicationAutoMapperProfile : Profile { public TenantDomainApplicationAutoMapperProfile() { // Mapping configuration here } }
5. **Remove and Re-Add Solution in Suite**
- Remove your solution from ABP Suite and add it again to refresh its internal file path cache.
6. **Check for Known Issues**
- This is a documented problem in the ABP support portal. See the following for more details and workarounds:
- [ABP Suite CRUD Generator: startIndex must be non-negative](https://abp.io/support/questions/9489)
### Additional Notes
- If you are using a microservice module, ABP Suite may not fully support CRUD code generation for all module types.
- If you have a custom or non-standard folder structure, try aligning it with the default ABP template.
---
Sources:
- [ABP Suite CRUD Generator: startIndex must be non-negative](https://abp.io/support/questions/9489)
---
_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._
Ensure the AppService is Publicly Exposed
[RemoteService] or [ApiController] if needed) and reside in a namespace that is included in the API definition.Module Must Be Properly Integrated
Gaming.Module.Cards) must be added as a dependency in your Host application and properly configured in the module system.Backend Host Must Be Running
abp generate-proxy.Correct Module Name in Command
-m cards parameter should match the remote service/module name as registered in your backend./api/abp/api-definition on your running backend.Check API Definition Endpoint
https://<your-host>/api/abp/api-definition?includeTypes=true to verify if your AppService endpoints are listed. If not, the proxy generator will not generate them.Re-run Proxy Generation
abp generate-proxy -t ng -m cards
Check for Errors or Warnings
If your AppService is still not being generated, ensure that:
For more details, see:
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 tooltip issue ("You do not have permission to perform any action") after upgrading to ABP 9.2.0 is a known behavioral change related to permission checks in the Blazor UI's DataGrid and EntityAction components. In recent ABP versions, the framework shows this tooltip when no visible actions are available to the user due to permission restrictions.
However, in some cases, this tooltip may appear prematurely—before permissions are fully resolved—especially after a page refresh or initial load. This is a side effect of how permission checks and UI rendering are handled in the new version.
Visible property and ensure permission checks are completed before rendering the DataGrid or EntityAction components.Example:
new EntityAction<MyEntity>(
"Edit",
L["Edit"],
visible: context => PermissionChecker.IsGrantedAsync("MyPermissionName").Result // or use async pattern properly
)
If you are using custom actions, ensure that the Visible property is set based on the user's permissions and that permission checks are not delayed.
If the issue persists on built-in pages, it is likely a framework-level behavior. You can monitor the official migration guide and GitHub issues for updates or patches:
Currently, there is no official configuration to suppress this tooltip globally, but you can override the tooltip text or logic in your custom components if needed.
If this behavior is blocking your users, consider reporting it on the ABP GitHub repository or support channels, as it may be addressed in a future patch.
Sources:
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.
.well-known/jwks endpoint returning 404 in ABP OpenIddict is typically due to missing or misconfigured signing/encryption certificates, or incorrect OpenIddict server setup—especially behind a proxy or API gateway.Solution Steps:
Certificate Configuration
PreConfigure<OpenIddictServerBuilder>(serverBuilder =>
{
var flag = X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.EphemeralKeySet;
serverBuilder.AddProductionEncryptionAndSigningCertificate("openiddict.pfx", "YourCertificatePassword", flag);
});
openiddict.pfx file is present in your deployment and the password is correct.Proxy/Forwarded Headers
app.UseForwardedHeaders(new ForwardedHeadersOptions
{
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
});
Check PathBase and Routing
app.UsePathBase("/auth") or similar, ensure your proxy forwards the base path and that all OpenIddict endpoints are accessible under the correct path.Verify Endpoint Exposure
.well-known/jwks is not excluded.Restart and Logs
References:
These steps should resolve the 404 on .well-known/jwks behind your proxy. If the issue persists, double-check certificate presence and permissions, and ensure your proxy is not stripping or rewriting the path.
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.
To upgrade your ABP microservice solution from version 4.2.2 to 9.0, follow these steps:
Review Migration Guides
Update .NET and ABP Packages
abp update
Update Microservice Template Structure
Apply Breaking Changes
Update Configuration Files
appsettings.json, DbMigrator settings, and other configuration files to match the new template and ABP 9.0 requirements.Database Migrations
DbMigrator project to apply any new or updated migrations.Test and Validate
Leverage New Features
Tip:
Upgrade in small increments (one major version at a time), commit and test after each step, and use a source control system to track changes.
Sources:
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.
To use TenantId as part of a composite key in an ABP entity, you must consider that EF Core does not allow nullable properties in primary keys. Since IMultiTenant.TenantId is nullable (to support host entities), making it part of a composite key will cause issues when TenantId is null (i.e., for host-owned entities).
If you define your entity as:
public class MyEntity : Entity, IMultiTenant
{
public Guid? TenantId { get; set; }
public Guid EntityId { get; set; }
public override object[] GetKeys()
{
return new object[] { TenantId, EntityId };
}
}
You will encounter problems saving entities with a null TenantId, because EF Core does not support nullable columns in primary keys.
Workarounds:
Example:
public class MyEntity : Entity<Guid>, IMultiTenant
{
public Guid? TenantId { get; set; }
// EntityId is now the primary key (from Entity<Guid>)
}
// In your DbContext:
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.Entity<MyEntity>()
.HasIndex(e => new { e.TenantId, e.Id })
.IsUnique();
}
This approach allows TenantId to be nullable and still enforces uniqueness for (TenantId, EntityId) without violating EF Core's primary key constraints.
Sources:
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.
To resolve the "This server only accepts HTTPS requests" error from OpenIddict when running your ABP AuthServer behind Nginx on Linux, you need to explicitly disable the HTTPS requirement in your configuration. By default, OpenIddict enforces HTTPS for security, but in reverse proxy scenarios (like Nginx terminating SSL), your backend app only sees HTTP traffic.
Solution:
In your appsettings.json, set:
"AuthServer": {
"Authority": "https://auth.mysite.it",
"RequireHttpsMetadata": "false",
"SwaggerClientId": "WebGateway_Swagger"
}
In your AuthServer module, add the following configuration to disable the transport security requirement when RequireHttpsMetadata is false:
if (!Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]))
{
Configure<OpenIddictServerAspNetCoreOptions>(options =>
{
options.DisableTransportSecurityRequirement = true;
});
}
Ensure your Nginx is correctly forwarding headers (X-Forwarded-Proto) so that ABP/OpenIddict can detect the original HTTPS scheme.
Note: The Authority should still be set to your public HTTPS URL (https://auth.mysite.it). Disabling the HTTPS requirement only affects backend validation, not the public endpoints.
Reference Implementation: https://abp.io/docs/latest/solution-templates/layered-web-application/deployment/openiddict-deployment
Summary:
"RequireHttpsMetadata": "false" in your config.DisableTransportSecurityRequirement code in your AuthServer.This will allow your OpenIddict endpoints (like /.well-known/jwks) to be accessible behind a reverse proxy using HTTPS, even though your backend listens on HTTP.
Sources:
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.