中 | EN
Responsibilities:
Assist in managing the dapr process to reduce the dependency on docker compose during development
- Install Masa.Utils.Development.Dapr.AspNetCore
Install-Package Masa.Utils.Development.Dapr.AspNetCore
- Add DaprStarter to assist in managing the dapr process (recommended to be used in the development environment)
builder.Services.AddDaprStarter();
- Specify the configuration in the code
builder.Services.AddDaprStarter(opt =>
{
opt.AppId = "masa-dapr-test";
opt.AppPort = 5001;
opt.AppIdSuffix = "";
opt.DaprHttpPort = 8080;
opt.DaprGrpcPort = 8081;
});
- The configuration file specifies the configuration
First step:
{
"DaprOptions": {
"AppId": "masa-dapr-test",
"AppPort": 5001,
"AppIdSuffix": "",
"DaprHttpPort": 8080,
"DaprGrpcPort": 8081
}
}
Step 2:
builder.Services.AddDaprStarter(builder.Configuration.GetSection("DaprOptions");
Advantages: After the configuration is changed, the dapr process is restarted and updated, and the project does not need to be restarted