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 |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 张高兴的大模型开发实战:(一)使用 Selenium 进行网页爬虫
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构