English | 简体中文
- .NET 8.0 SDK
- Database (support any of the following):
- MySQL
- SQL Server
- SQLite
- Oracle
- Oracle Devart
- PostgreSQL
- Redis
dotnet tool install --global LINGYUN.Abp.Cli
# Short name: laa (LINGYUN Abp AllInOne)
labp create YourCompanyName.YourProjectName -pk YourPackageName -t laa -o /path/to/output --dbms MySql --cs "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None" --no-random-port
Parameter Description:
-pk
or--package-name
: Package name-t
or--template
: Template type, uselaa
for All-in-One template-o
or--output
: Output directory--dbms
: Database type, supports MySql, SqlServer, Sqlite, Oracle, OracleDevart, PostgreSql--cs
: Database connection string--no-random-port
: Do not use random port
After creating the project, navigate to the project directory:
cd /path/to/output/host/YourPackageName.YourCompanyName.YourProjectName.AIO.Host
dotnet run --launch-profile "YourPackageName.YourCompanyName.YourProjectName.Development"
- .NET 8.0 SDK
- Database (support any of the following):
- PostgreSQL
- MySQL
- SQL Server (coming soon)
- Redis
- Docker (optional)
- Ensure .NET 8.0 SDK is installed
- Execute the following command in the project root directory to compile the entire project:
./build/build-aspnetcore-release.ps1
- Open the
LY.MicroService.Applications.Single
solution in your IDE for debugging or publishing
Multiple databases are supported. Here are configuration examples for each:
# Start PostgreSQL using Docker
docker run -d --name postgres \
-p 5432:5432 \
-e POSTGRES_PASSWORD=postgres \
-e PGDATA=/var/lib/postgresql/data \
postgres:latest
# Start MySQL using Docker
docker run -d --name mysql \
-p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=mysql \
mysql:latest
Create database:
CREATE DATABASE `Platform-V70`;
# Start SQL Server using Docker
docker run -d --name sqlserver \
-p 1433:1433 \
-e "ACCEPT_EULA=Y" \
-e "SA_PASSWORD=yourStrong(!)Password" \
mcr.microsoft.com/mssql/server:latest
Modify the database connection strings in the following configuration files according to your chosen database:
migrations/LY.MicroService.Applications.Single.DbMigrator/appsettings.json
LY.MicroService.Applications.Single/appsettings.Development.json
Database connection string examples:
PostgreSQL:
{
"ConnectionStrings": {
"Default": "Host=127.0.0.1;Database=Platform-V70;Username=postgres;Password=123456;"
}
}
MySQL:
{
"ConnectionStrings": {
"Default": "Server=127.0.0.1;Database=Platform-V70;User Id=root;Password=123456;SslMode=None"
}
}
SQL Server (coming soon):
{
"ConnectionStrings": {
"Default": "Server=localhost,1433;Database=Platform-V70;User Id=sa;Password=yourStrong(!)Password;TrustServerCertificate=True"
}
}
# Start Redis using Docker
docker run -d --name redis -p 6379:6379 redis:latest
Redis configuration example:
{
"DistributedLock": {
"IsEnabled": true,
"Redis": {
"Configuration": "127.0.0.1,defaultDatabase=14"
}
},
"Redis": {
"IsEnabled": true,
"Configuration": "127.0.0.1,defaultDatabase=15",
"InstanceName": "LINGYUN.Abp.Application"
},
"Features": {
"Validation": {
"Redis": {
"Configuration": "127.0.0.1,defaultDatabase=13",
"InstanceName": "LINGYUN.Abp.Application"
}
}
}
}
The following configurations are applicable for monolithic distributed architecture:
{
"Minio": {
"WithSSL": false,
"BucketName": "blobs",
"EndPoint": "127.0.0.1:19000",
"AccessKey": "{AccessKey}",
"SecretKey": "{SecretKey}",
"CreateBucketIfNotExists": false
}
}
{
"Elasticsearch": {
"NodeUris": "http://127.0.0.1:9200"
}
}
- Run database migration script:
Option 1 (Recommended):
./aspnet-core/migrations/Migrate.ps1
Follow the command line prompts to generate migration files and SQL scripts, then execute the SQL scripts to create database tables
Option 2: Taking PostgreSQL as an example:
- Modify database connection information in
LY.MicroService.Applications.Single.DbMigrator/appsettings.PostgreSql.json
- Navigate to
LY.MicroService.Applications.Single.EntityFrameworkCore.PostgreSql
project - Run
dotnet ef database update
- Wait for migration completion
-
Configure data initialization:
- Modify database connection information in
LY.MicroService.Applications.Single.DbMigrator/appsettings.json
- Ensure the correct database provider is selected
- Modify database connection information in
-
Execute data migration:
- Run the
LY.MicroService.Applications.Single.DbMigrator
project - Wait for migration to complete, basic table data will be initialized
- Run the
- Run the
LY.MicroService.Applications.Single
project - Access Swagger API documentation in your browser:
{
"App": {
"ShowPii": true,
"SelfUrl": "http://127.0.0.1:30001/",
"CorsOrigins": "http://127.0.0.1:3100,http://127.0.0.1:30001"
}
}
{
"DistributedCache": {
"HideErrors": true,
"KeyPrefix": "LINGYUN.Abp.Application",
"GlobalCacheEntryOptions": {
"SlidingExpiration": "30:00:00",
"AbsoluteExpirationRelativeToNow": "60:00:00"
}
}
}
{
"OpenIddict": {
"Applications": {
"VueAdmin": {
"ClientId": "vue-admin-client",
"RootUrl": "http://127.0.0.1:3100/"
}
},
"Lifetime": {
"AccessToken": "14:00:00",
"IdentityToken": "00:20:00",
"RefreshToken": "14:00:00"
}
}
}
{
"Identity": {
"Password": {
"RequiredLength": 6,
"RequireNonAlphanumeric": false,
"RequireLowercase": false,
"RequireUppercase": false,
"RequireDigit": false
},
"Lockout": {
"AllowedForNewUsers": false,
"LockoutDuration": 5,
"MaxFailedAccessAttempts": 5
},
"SignIn": {
"RequireConfirmedEmail": false,
"RequireConfirmedPhoneNumber": false
}
}
}
{
"FeatureManagement": {
"IsDynamicStoreEnabled": true
},
"SettingManagement": {
"IsDynamicStoreEnabled": true
},
"PermissionManagement": {
"IsDynamicStoreEnabled": true
}
}
{
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"System": "Warning",
"Microsoft": "Warning"
}
},
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "Logs/Info-.log",
"rollingInterval": "Day"
}
}
]
}
}
If you encounter problems, please check:
- Database connection string is correct
- Correct database provider is selected
- Redis connection is working
- Required ports are not occupied
- Database migration completed successfully
- Authentication server configuration is correct
- CORS configuration is correct (if frontend access has cross-origin issues)