学海无涯

导航

Dapr命令

运行Dapr sidecar

一、命令行运行Dapr

以下命令以启动 Dapr sidecar,它将在端口 3500 上监听名为 myapp 的空白应用程序:

dapr run --app-id myapp --dapr-http-port 3500

并使用默认组件 (%USERPROFILE%\.dapr\components在 Windows)。 这些告诉 Dapr 使用本地的 Redis Docker 容器作为状态存储和消息代理

 

dapr run --app-id aps --app-port 5000 --dapr-http-port 50000 -- dotnet run --ruls http://+:5000

 运行第二个微服务:

dapr run --app-id aps2 --app-port 5002 --dapr-http-port 50002 -- dotnet run --ruls http://++5002

二、Powseshell 命令方式运行 Dapr(推荐,优点:只需输入一次命令,以后可多次快速执行)

Powseshell 命令文件 startselfhost.ps1:

dapr run `
    --app-id daprCounter `
    --app-port 5266 `
    --dapr-http-port 3500 `
    --components-path dapr/components `
    dotnet run

执行Powseshell 命令:

参数:--components-path 在那个目录下查找定义组件的yaml文件

有配置文件的 Powseshell 命令:

dapr run `
    --app-id trafficcontrolservice `
    --app-port 6000 `
    --dapr-http-port 3600 `
    --dapr-grpc-port 60000 `
    --config ../dapr/config/config.yaml `
    --components-path ../dapr/components `
    dotnet run

  

 

posted on 2022-11-01 08:50  宁静致远.  阅读(230)  评论(0编辑  收藏  举报