如何正确停止运行dotnet核心Web应用程序? [英] How to properly stop running dotnet core web application?

查看:67
本文介绍了如何正确停止运行dotnet核心Web应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows上的Visual Studio 2017和2019中,我在程序包管理器控制台中运行 dotnet watch run .它为网络netnet核心应用程序的红est午餐,在控制台中自动禁用了文本编辑,并显示红色按钮以停止命令执行,但是该按钮没有任何作用.此外,该消息还显示为使用 Ctrl + C ,但它也不起作用.

In Visual Studio 2017 and 2019 on windows I run dotnet watch run in the Package Manager Console. It lunched kestrel for dotnet core app, automatically disabled text edit in the console and displayed red button to stop command execution, but the button doesn't do anything. Also the message is being displayed to use Ctrl+C but it doesn't work either.

Now listening on: http://localhost:20436 Application started. Press Ctrl+C to shut down.

现在,当我尝试在Visual Studio中对该Web应用程序进行午餐时,因为它已经在运行,所以会出现错误.我找不到像Ctrl + C这样的 dotnet stop 这样的命令,在这种情况下不起作用.我使用Process Hacker杀死dotnet.exe进程,但这似乎不正确.杀死正在运行的进程的最佳方法是什么?

Now there is an error when I try to lunch the web app in Visual Studio because it is already running. I couldn't find command like dotnet stop only Ctrl+C which doesn't work in this case. I used Process Hacker to kill dotnet.exe process but that doesn't seem right. What would be the best way to kill the running process?

推荐答案

杀死[id]

免费"您的控制台,您可以将输出放入LogFile,以便您也可以使用控制台来结束进程:=)

To "free" your Console you can take output into a LogFile so you ca use console to also end process :=)

运行您的项目:

dotnet运行>zLogs.log&

dotnet run > zLogs.log &

$ dotnet运行>zLogs.log&

[1] 162

结束项目:

杀死162

$ kill 162

[1] +退出127 dotnet run>zLogs.log

因此,您不需要第二个控制台,并且可以将您的控制台用于其他输入.请注意,所有输出将存储在您必须检查的zLog.log文件中

So you not need a second console and can use your console for other inputs. Take note that all outputs will be stored inside the zLog.log-File you have to check

这篇关于如何正确停止运行dotnet核心Web应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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