当我停止调试时停止开发服务器

发布于 2024-08-03 13:21:26 字数 49 浏览 5 评论 0原文

当我在 Visual Studio 中停止调试时,如何自动停止开发 Web 服务器?

How can automatically I stop the development web server when I stop debugging in Visual Studio?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

笑看君怀她人 2024-08-10 13:21:26

解决方法:在 Visual Studio 中使用 ASP.Net Web 服务器调试 Global.aspx.cs Application_Start()

在 Web 服务器项目上启用“编辑并继续”对我有用。当您停止调试时,它不会关闭 cassini,但当您开始调试时,它会重新启动 cassini。

Workaround: Debugging Global.aspx.cs Application_Start() with ASP.Net Web Server within Visual Studio

Enabling "Edit & Continue" on the web server project worked for me. It doesnt shutdown cassini when you stop debugging, but it does restart cassini when you start debugging.

紫竹語嫣☆ 2024-08-10 13:21:26

当您点击“停止调试”按钮时,没有办法让 Asp.Net 开发服务自动停止,因为所做的只是分离调试器。但是,您可以自己显式终止该进程(这反过来会导致 VS 停止调试)。

此问题显示了如何在宏中执行此操作:

自动停止/restart ASP.NET Development Server on Build

或者看看 mat3 的答案,了解如何在每次开始调试时强制开发服务器重新启动(尽管在完成调试会话后它仍将保持运行状态,直到接下来运行你的项目)。

There is no way to get the Asp.Net development service to automatically stop when you hit the "stop debugging" button, as all that does is detach the debugger. You could however explicitly kill the process yourself (which would in turn cause VS to stop debugging).

This question shows how you might do this in a Macro:

Automatically stop/restart ASP.NET Development Server on Build

Alternatively take a look at mat3's answer on how you can force the development server to restart every time you start debugging (although it will still remain running after you have finished your debugging session until you next run your probject).

朮生 2024-08-10 13:21:26

另一个技巧是更新构建后事件的 web.config 时间戳。您可以在我对 Visual Studio 能否在新的调试会话上重新启动 IIS Express? 问题。

Another trick is to update web.config timestamp on post-build event. You may find detailed instructions how to do that in my answer to the Can Visual Studio restart IIS Express on new debugging session? question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文