学海无涯

导航

统计

Dapr命令

运行Dapr sidecar

一、命令行运行Dapr

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

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

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

 

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

 运行第二个微服务:

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

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

Powseshell 命令文件 startselfhost.ps1:

1
2
3
4
5
6
dapr run `
    --app-id daprCounter `
    --app-port 5266 `
    --dapr-http-port 3500 `
    --components-path dapr/components `
    dotnet run

执行Powseshell 命令:

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

有配置文件的 Powseshell 命令:

1
2
3
4
5
6
7
8
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   宁静致远.  阅读(230)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 张高兴的大模型开发实战:(一)使用 Selenium 进行网页爬虫
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
点击右上角即可分享
微信分享提示