首页 > 编程语言 >微服务实践之使用 Visual Studio 2022 调试Dapr 应用程序

微服务实践之使用 Visual Studio 2022 调试Dapr 应用程序

时间:2024-06-02 13:32:39浏览次数:18  
标签:http -- Visual Dapr Studio true localhost

安装配置相关软件

安装 PowerShell 7 / Core

dotnet tool install --global PowerShell

安装 Visual Studio 扩展 Microsoft Child Process Debugging Power Tool 2022

安装插件后启动 Visual Studio,可以在 Debug -> Other Debugging Targets 中找到 Child Process Debugging Settings。

这里save按钮要点,上面的保存按钮也要点

生成配置文件

<?xml version="1.0" encoding="utf-8"?>
<ChildProcessDebuggingSettings IsEnabled="true" xmlns="http://schemas.microsoft.com/vstudio/ChildProcessDebuggingSettings/2014">
  <DefaultRule Attach="false" />
  <Rule IsEnabled="true" ProcessName="dapr.exe" CommandLine="" EngineFilter="{3b476d35-a401-11d2-aad4-00c04f990171}" />
  <Rule IsEnabled="true" ProcessName="dotnet.exe" CommandLine="" EngineFilter="{3b476d35-a401-11d2-aad4-00c04f990171}" />
  <Rule IsEnabled="true" ProcessName="front.exe" CommandLine="" EngineFilter="{2e36f1d4-b23c-435d-ab41-18e608940038}" />
  <Rule IsEnabled="false" ProcessName="pwsh.exe" CommandLine="" EngineFilter="{3b476d35-a401-11d2-aad4-00c04f990171}" />
</ChildProcessDebuggingSettings>

修改launchSettings.json

{
  "profiles": {
    "http": {
      "commandName": "Project",
      "launchBrowser": true,
      "launchUrl": "swagger",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "dotnetRunMessages": true,
      "applicationUrl": "http://localhost:5000"
    },
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "launchUrl": "swagger",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "Container (Dockerfile)": {
      "commandName": "Docker",
      "launchBrowser": true,
      "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
      "environmentVariables": {
        "ASPNETCORE_HTTP_PORTS": "8080"
      },
      "publishAllPorts": true
    },
    "Dapr-PWSH": {
      "commandName": "Executable",
      "executablePath": "pwsh",
      "commandLineArgs": "-Command \"dapr run --app-id front --app-port 5000 --app-protocol grpc --log-level debug -- dotnet run --no-build\"",
      "workingDirectory": ".",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "nativeDebugging": true,
      "dotnetRunMessages": "true",
      "applicationUrl": "http://localhost:5000;https://localhost:5001"
    }
  },
  "$schema": "http://json.schemastore.org/launchsettings.json",
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:12247",
      "sslPort": 0
    }
  }
}

运行项目

切换到backend项目,运行下面命令,注意端口

dapr run --app-id backend --app-port 5001 dotnet run

开始调试front项目

访问:http://localhost:5000/swagger/index.html

正常进入调试

相关源码下载

相关文章

作者

吴晓阳 微信号:shiningrise

标签:http,--,Visual,Dapr,Studio,true,localhost
From: https://www.cnblogs.com/shiningrise/p/18227020

相关文章

  • arturia minilab mk2 midi键盘 连接 flstudio (其他型号也是适用)
    小白学编曲,买了一个二手midi键盘作为入门,刚到的时候一头雾水,摸索了一阵子之后明白如何使用了。这个方法可以根据自己的喜好来随意配置midi键盘与水果的交互软件准备flstudio21(其他版本也类似)midicontrolcenterarturia的官网就可以下到https://www.arturia.com/support/......
  • 基于Open3D的点云处理20- 基于Visualizer类自定义可视化
    1.自定义可视化官网测试用例Open3D/examples/python/visualization/customized_visualization.py自定义可视化工具窗口-Visualizer类Visualizer可视化基础操作defcustom_draw_geometry(pcd):#Thefollowingcodeachievesthesameeffectas:#o3d.v......
  • AndroidStudio资料
    AndroidStudio导入jar包  Switch语句报错Constantexpressionrequired   AndroidStudio中怎样引用图片资源   新版本Logcat使用详解java反编译jar包并修改class重新打包   Jar包反编译后修改源码再编译java.lang.NoClassDefFoundError:Failedresolutionof:......
  • Android Studio 已经安装 NDK ,但是软件提示找不到。
    AndroidStudio已经安装NDK,但是软件提示找不到。推荐安装win11android-studio-ide-192.6392135-win64jdk-8u381-windows-x64.exeNDKversionis20.0.5594570提示找不到ndk解决办法:在GradleScripts下面的local.properties文件中,手动添加ndk路径:ndk.dir=C:\User......
  • Android Studio ERROR: Installed Build Tools revision 34.0.0 is corrupted. Remove
    AndroidStudio错误提示:ERROR:InstalledBuildToolsrevision34.0.0iscorrupted.RemoveandinstallagainusingtheSDKManager.解决办法:在C:\Users\Administrator\AppData\Local\Android\Sdk\build-tools\34.0.0目录中找到d8.bat,将文件名修改为dx.bat在C:\Us......
  • visual studio IDE 17.10版本 折叠区域高亮问题
    最近vs更新到了17.10版本发现折叠的区域会高亮效果如下 可以看到折叠的区域会呈现一种高亮显示我个人是觉得会分散我注意力下面是关掉的操作 把红框改成自动(ps:可以打中文"可"快速定位到"可折叠区域")这样改完后效果如下 ......
  • Visual Studio 2022安装SVN插件教程
    原文链接:https://blog.csdn.net/weixin_44504146/article/details/1328311011.第一步:避免踩坑,超级重要!!!关闭VisualStudio2022应用程序;(不然插件装不上,一直转圈!)2.第二步:下载VisualStudio2022版本对应的SVN插件https://www.visualsvn.com/visualsvn/download/(注意对应版本20......
  • vs2022安装 社区版/Visual Studio 2022 Professional、Enterprise安装教程
    原文链接:https://zhuanlan.zhihu.com/p/472099786https://blog.csdn.net/qq_38390060/article/details/129580789一、Windows安装VisualStudio20221.1下载地址首先登陆VisualStudio官网:https://visualstudio.microsoft.com/zh-hans/ 2、我们双击开始安装之后会弹出安......
  • 使用LM Studio来运行本地版本大语言模型
     自2022年11月30日发布ChatGPT对话性大预言模型,AI再一次被推向了高潮,再到后来,国内外也衍生了大量的语言模型开放给公众使用。为了可以让更多人接触到AI,让本地化部署更加轻便快捷,于是就有了Ollama、LMStudio等可以在本地部署模型的工具。这两款工具相比较来说,个人觉的LMStudio......
  • Visual Studio各版本区别
    原文链接:https://jingyan.baidu.com/article/b907e62779e68346e7891ccf.htmlVisualStudio是微软开发的一款集成开发工具。它能够支持现在IT行业上主流的编程语言。非常的专业性,深受现在程序猿的喜爱。但是VisualStudio版本很多,这往往导致许多程序猿不知道如何选择?下面,小编就为......