In order to start application you should start HttpApi.Host project first, then start .Blazor project
In order to log in to the system use this default credentials: Login - admin, password - 1q2w3E*
1. Switch to EF Core SQLite Provider:
https://docs.abp.io/en/abp/latest/Entity-Framework-Core-SQLite
For SQLite connection string use this pattern: "Filename=./MyDatabaseName.db", this pattern will create databases in
binfolder of the project where migrations are executed
2. Separate host and identity data bases-
- Create db context and design time db factory for new database using this article
Don't forget to set attribute
ConnectionStringfor your new db context. Make your db context look like in here
- Automate migration for second db context using this article
- Edit
OnModelCreatingmethod of your new db context so it looks like in this article - You can run
.DbMigratorproject now - Check
bin->Debug->net7.0folder. Here you will find your new database
3. Make manipulations with host database
In previous step we separated host and identity databases. So let make a test migration to host database.
First of all put your database in this folder
.DbMigrator->bin->Debug->net7.0
Follow this steps:
-
Create simple class,
CustomerDemographicsyou can find it here. -
Inside your
DbContextfor host database addDbSet:
public DbSet<CustomerDemographics> CustomerDemographics { get; set; }
- Add this code in the
OnModelCreatingmethod ofDbContextfor host database:
builder.Entity<CustomerDemographics>(b =>
{
b.ToTable("CustomerDemographics");
b.HasKey(x => x.CustomerTypeId);
b.HasData(new CustomerDemographics() { CustomerTypeId = 1, CustomerDescription = "Lorem ipsum" });
});
- Add migration (I attach sample that works for my project, for your project use your db context name):
Please remember that you should run this command in directory where your db context is
dotnet ef migrations add AddCustomerDemographics --context OMSBlazorDbContext
-
Run db migrator
-
Now you can check changes in your host database
4. Add configuration for SQLite
In the OMSBlazorEntityFrameworkCoreModule class of the .EntityFrameworkCore project add this lines of code:
//This configuration is needed for sqlite
//https://github.com/abpframework/abp/issues/5661?ysclid=lhfcwt9oqb875559031
Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
5. Add required connection strings
In appsettings.json file of the .HttpApi.Host project add this connection strings:
"Default": "Filename=./NorthwindSQLite.db",
"AbpIdentity": "Filename=./NorthwindIdentitySQLite.db",
"AbpFeatureManagement": "Filename=./NorthwindIdentitySQLite.db",
"AbpAuditLogging": "Filename=./NorthwindIdentitySQLite.db"
Default - connection string is needed for connecting to the database where you store your Northwind
Why do we need other three connection strings(AbpIdentity, AbpFeatureManagement, AbpAuditLogging)?
So this three connection strings are pointing to the database where tables for related module stored.
So for example in this current case tables for Identity, Feature, and Audit logging modules are stored in
NorthwindIdentitySQLite database. If you don't write this connection strings ABP will try to find this tables
in the Default connection string(this is how Abp works)
Tutorial of integration MudBlazor is here - https://github.com/yellow-dragon-cloud/AbpMudBlazor
Example of this service you can find here.
Discussion about this you can find here
In a nutshell: your service should implement
IRemoteService
- To .NET 8 migration notes:
- Add migration that add
AbpSettingDefinitionstable toNorthwindSQLite
1.1 To do this you can just create empty migration forOMSBlazorDbContextand copy content of20240115220346_AddSettingsTable(you can find this file on this path:OMSBlazor.EntityFrameworkCore->Migrations) - Add migration that add
LastPasswordChangeTimecolumn toAbpUserstable inNorthwindIdentitySQLite
2.1 To do this you can just create empty migration forOMSBlazorIdentityDbContextand copy content of20240116200534_AddLastPasswordChangeTimeColumn(you can find this file on this path:OMSBlazor.EntityFrameworkCore->OMSBlazorIdentity) - Take instance of database that is now in
OMSBlazor.HttpApi.Hostand put it into thebinfolder of theOMSBlazor.DbMigratorproject and runOMSBlazor.DbMigrator. This project will add new tables to the existing database - Copy back updated DBs to the
OMSBlazor.HttpApi.Host
There is a list of problems that you may encounter during publication. List of problems and theirs solutions
Solution: Turn on Load the user profile state on IIS
- On Plesk pannel of your domain you will find tab Hosting & DNS press it
- Then you will see Dedicated IIS Application pool for Website press
- There you will see checkbox - Load the user profile, check it
Solution: Go to class where you add OpenIddict to your DI. In my case this is OMSBlazorHttpApiHostModule
and comment the line which adds dependency to the OpenIddict.
[DependsOn(
...
//typeof(AbpAccountWebOpenIddictModule),
...
)]
public class OMSBlazorHttpApiHostModule : AbpModule
{
}
- When publicating newer version of backend you can have 403 error after the publication.
- In the Web Application Firewall(you will find it on the dashboard) change Web application firewall mode to Detection only
During last couple of days (this note is created on 02.05.2025) we struggled with problem that our hosting server - Adaptive Web Host
was not able to find appsettings.json file of OMSBlazor.Client project. Even though this file was on the server. The reason of this problem was that we don't included appsettings.json file into publish folder.
We did this because we did want to update this file every time and exactly this was causing the problem, once we start to include this file into publish folder, hosting server starts to work without errors.
No explanation for this yet but taking note of this, since this may help in future troubleshooting.
