我应该在哪个进程上附加Visual Studio Debugger来调试Kestrel应用程序? [英] To which process should I attach Visual Studio Debugger to debug a Kestrel application?

查看:87
本文介绍了我应该在哪个进程上附加Visual Studio Debugger来调试Kestrel应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打开命令行并使用dotnet run命令运行我的应用程序.这将启动Kestrel并启动我的应用程序.

I am bringing up command line and running my app using dotnet run command. This starts Kestrel and brings up my application.

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

How should I go with identify to which process to attach debugger so I can debug the website that Kestrel now hosts?

我特别需要能够通过这种方式进行操作-意味着我不能使用标准F5.

I specifically need to be able to do it this way - meaning I can't use standard F5.

推荐答案

不幸的是,目前无法使用Visual Studio或.NET Core提供的工具来判断.但是请注意,社区已经在此处要求使用此功能,因此您可以在那里发表您的意见.

Unfortunately, there is no way to tell right now using the tools provided by Visual Studio or .NET Core. Notice, though, that the community has already requested for this feature here, so you can voice your opinion there.

当前,最好的选择是遵循以下步骤:

Currently, the best option is to follow the steps to find out the id of the process given the application's port:

  1. 运行netstat -abon | findStr "127.0.0.1:{PORTNUMBER}"
  2. 查找上面返回的进程的ID,为了更快地查找,名称为dotnet.exe
  1. Run netstat -abon | findStr "127.0.0.1:{PORTNUMBER}"
  2. Find the Id of the process returned above, and, for faster lookup, the name will be dotnet.exe

如果您喜欢冒险,可以使用类似PowerShell的东西,它会直接返回端口号:

If you feel adventurous, you may want to use something like this PowerShell, which will return directly the port number:

 $string = netstat -abon | findStr "127.0.0.1:{PORTNUMBER}"; $results = $string.split(' '); $results[$results.length - 1]

这篇关于我应该在哪个进程上附加Visual Studio Debugger来调试Kestrel应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆