当我停止调试时停止开发服务器
当我在 Visual Studio 中停止调试时,如何自动停止开发 Web 服务器?
How can automatically I stop the development web server when I stop debugging in Visual Studio?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
解决方法:在 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.
当您点击“停止调试”按钮时,没有办法让 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).
另一个技巧是更新构建后事件的 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.