最终结果:
我想将Visual Studio调试器连接到在Kubernetes集群上作为Pod运行的.net Core应用程序。
我目前正在尝试遵循本指南:Debugging ASP.NET core apps in Kubernetes
我正在尝试运行以下Powershell命令以连接到调试器:
Write-Host '1. searching pod by selector:' $Selector '...';
$pod = kubectl get pods --selector=$Selector -o jsonpath='{.items[0].metadata.name}';
Write-Host '6. seaching for' $cmd 'process PID in pod:' $pod '...';
$prid = kubectl exec $pod -i -- pidof -s 'dotnet';
Write-Host '7. attaching debugger to process with PID:' $pid 'in pod:' $pod '...';
kubectl exec $pod -i -- /vsdbg/vsdbg --interpreter=mi --attach $prid;
我遇到的问题是最后一步,当我尝试运行此错误时,出现以下错误:
Error: Unknown switch '--attach=1'.
我尝试查看帮助文件,该文件不包含附加到进程ID的另一个相似的参数
问题,我该如何附加vsdbg?