gpt4 book ai didi

visual-studio - 我应该将 Visual Studio Debugger 附加到哪个进程来调试 Kestrel 应用程序?

转载 作者:行者123 更新时间:2023-12-04 07:30:28 24 4
gpt4 key购买 nike

我正在调出命令行并使用 dotnet run 运行我的应用程序命令。这将启动 Kestrel 并调出我的应用程序。

我应该如何确定要附加调试器的进程,以便调试 Kestrel 现在托管的网站?

我特别需要能够这样做 - 这意味着我不能使用标准 F5。

最佳答案

不幸的是,现在无法使用 Visual Studio 或 .NET Core 提供的工具进行判断。但是请注意,社区已经要求使用此功能 here ,所以你可以在那里发表你的意见。

目前,最好的选择是按照以下步骤操作 to find out the id of the process given the application's port :

  • 运行 netstat -abon | findStr "127.0.0.1:{PORTNUMBER}"
  • 找到上面返回的进程的 ID,为了更快地查找,名称将为 dotnet.exe

  • 如果你喜欢冒险,你可能想使用类似这个 PowerShell 的东西,它会直接返回端口号:
     $string = netstat -abon | findStr "127.0.0.1:{PORTNUMBER}"; $results = $string.split(' '); $results[$results.length - 1]

    关于visual-studio - 我应该将 Visual Studio Debugger 附加到哪个进程来调试 Kestrel 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50806765/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com