简体   繁体   English

VS2022:如何让 ASP.NET Core 5 应用程序显示它的控制台窗口

[英]VS2022: how to make ASP.NET Core 5 app show it's console window

In VS2019, when I start my ASP.NET Core 5 app, which just exposes an API, if that matters, a console window pops up for that app.在 VS2019 中,当我启动我的 ASP.NET Core 5 应用程序时,它只公开一个 API,如果这很重要,则会为该应用程序弹出一个控制台窗口。 There used to be some setting to decide whether to run it as a console / standalone app or host it in IIS Express.曾经有一些设置来决定是将其作为控制台/独立应用程序运行还是在 IIS Express 中托管。 I always preferred the console / standalone version because it lets me see the logs in realtime.我一直更喜欢控制台/独立版本,因为它可以让我实时查看日志。

In VS2022, when I start the very same project, no window appears at all, and, interestingly, neither do I see IIS Express starting up.在 VS2022 中,当我启动同一个项目时,根本没有窗口出现,有趣的是,我也没有看到 IIS Express 启动。

How can I get back to having the project start as a console app?我怎样才能回到让项目作为控制台应用程序启动的状态? (Except starting it from the command-line and then attaching the debugger.) (除了从命令行启动它然后附加调试器。)

UPDATE:更新:

ok, so at long last I noticed that, strangely, a minimized console window is being created and because I start a dozen projects (microservices), I didn't notice before, and procexplorer telling me that the executable had no window added to the confusion.好的,所以最后我注意到,奇怪的是,正在创建一个最小化的控制台窗口,因为我启动了十几个项目(微服务),我之前没有注意到,并且 procexplorer 告诉我可执行文件没有窗口添加到困惑。 So this is much less problematic, albeit still weird - why does this one particular application not start un-minimized?所以这问题要小得多,尽管仍然很奇怪——为什么这个特定的应用程序没有以未最小化的方式启动? The only difference it has to all the other executables is that it uses ASP.net core while the others (all background services communicating via messagequeue) don't.它与所有其他可执行文件的唯一区别是它使用 ASP.net 核心,而其他(所有通过消息队列进行通信的后台服务)则不使用。

and this only in VS2022, in VS2019 all executables including this one start unminimize这仅在 VS2022 中,在 VS2019 中,包括这个在内的所有可执行文件都开始取消最小化

You have to make sure, that you selected "IIS Express" as your debug profile您必须确保您选择了“IIS Express”作为您的调试配置文件

VS 2022 debug profile VS 2022 调试配置文件

I believe you are looking for this.我相信你正在寻找这个。 Follow the steps highlighted in in each image:按照每个图像中突出显示的步骤进行操作:

  • Go to your project properties:转到您的项目属性:

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

Then you will see that the console is open in the task bar.然后你会看到控制台在任务栏中打开了。 在此处输入图像描述

In Visual Studio 2022 this is currently NOT POSSIBLE在 Visual Studio 2022 中,这目前是不可能的

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 控制台窗口中的ASP.Net Core App输出? - ASP.Net Core App Output in a Console Window? 如何在 ASP.NET Core(.NET 6、VS 2022)中禁用浏览器链接 - How to disable Browser Link in ASP.NET Core (.NET 6, VS 2022) Asp.Net Core:如何使浏览器显示文件在发送之前被下载 - Asp.Net Core: how to make the browser show file as being downloaded before it's sent 如何在 Visual Studio ASP.NET Core web 项目中的每次重建时使 Kestrel 控制台 window 自动关闭/重置? - How to make Kestrel console window auto close/reset upon each rebuild in Visual Studio ASP.NET Core web projects? Net Core Ajax Jquery 将 Null 值传递给控制器​​,Vs2022,.Net 6 - Net Core Ajax Jquery Passing Null Value to Controller, Vs2022, .Net 6 防止VS2022 .net Core API build中的随机端口号 - Prevent random port number in VS2022 .net Core API build 在控制台应用程序中注入ILoggerFactory与在asp.net核心1.1中实例化一个 - Injecting ILoggerFactory in Console app vs instantiating one in asp.net core 1.1 在 asp.net 核心控制台应用程序中使用 log4net 进行日志记录 - Logging with log4net in asp.net core console app ASP.NET MVC Core 6 中的 User.FindFirstValue(ClaimTypes.Email) 使用 VS 2022 返回 Null - User.FindFirstValue(ClaimTypes.Email) in ASP.NET MVC Core 6 using VS 2022 returns Null ASP.NET Core 6:如何在启动时将控制台 window 带到前台 - ASP.NET Core 6: how to bring the console window to the foreground upon launch
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM