The documentation you are viewing is for Dapr v1.5 which is an older version of Dapr. For up-to-date documentation, see the latest version.
Dapr Visual Studio Core扩展概述
Dapr 为本地开发提供了预览版 Dapr Visual Studio Code扩展,使用户能够获得与更好地管理其Dapr应用程序和调试您的Dapr应用程序有关的各种功能,这些Dapr语言包括.NET、Go、PHP、Python和Java。
特性
Dapr 调试任务脚手架
Dapr扩展可以帮助您使用Visual Studio Code的内置调试功能来调试您的应用程序。
使用Dapr: Scaffold Dapr Tasks
Command Palette操作,你可以更新你现有的task.json
和launch.json
文件,在你开始调试时启动并配置Dapr sidecar。
- 请确保您的应用程序有一个启动配置。 (了解更多)
- 使用
Ctrl+Shift+P 打开Command Palette
- 选择
Dapr: Scaffold Dapr Tasks
- 用
F5
或通过运行视图运行你的应用程序和Dapr sidecar。
Dapr 组件脚手架
当添加Dapr到你的应用程序时,你可能希望有一个专门的组件目录,与作为dapr init
的一部分初始化的默认组件分开。
若要创建一个专用的组件文件夹,默认 statestore
, pubsub
, 和 zipkin
组件, 使用 Dapr: Scaffold Dapr Components
Command Palette 操作。
- 在 Visual Studio Code中打开您的应用程序目录
- 使用
Ctrl+Shift+P 打开Command Palette
- 选择
Dapr: Scaffold Dapr Components
- 使用
dapr run --components-path ./components -- ...
运行你的应用程序
查看正在运行的 Dapr 应用程序
Applications视图显示在您的机器上本地运行的Dapr应用程序。
调用 Dapr 应用的方法
在Applications视图中,用户可以右击并通过GET或POST方法调用Dapr应用程序,可选择指定有效载荷。
发布事件到 Dapr 应用程序
在Applications视图中,用户可以右键单击并向正在运行的Dapr应用程序发布消息,指定主题和有效载荷。
用户也可以向所有正在运行的应用程序发布消息。
其他资源
同时调试多个Dapr应用程序
使用 VS Code 扩展,您可以通过Multi-target debugging同时调试多个Dapr应用程序.
社区示例
观看有关如何使用 Dapr VS 代码扩展的 视频:
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.