stop development server when i stop debugging
Asked Answered
S

3

18

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

Spectroscopy answered 26/8, 2009 at 14:3 Comment(9)
why would you need to do that? its not like a WinForm Environment. In a web application you can edit code while the dev server is still running, and hit refresh and see the changes.Warrington
i want it to stop because the application keeps working when the development server is runningSpectroscopy
how is that possible? unless you have some client side code that continues?Warrington
When the application start it creates a thread that do somework and that thread keeps running as long as the development server is runningSpectroscopy
ok, that makes a little more sense, do you not have any stopping conditions for this thread that you spawn?Warrington
no ! it just stops when the app stopsSpectroscopy
I have the opposite problem on one machine. My development server stops when pressing stop on the debug in visual studio. I only came across your posting is because I wast trying to find a solution for my particular problem.Methanol
@Methanol did you find a solution to your problem? I have the same...Urdu
@Urdu nope, I have since moved on to another machine and this one does not exhibit those issues. Plus I have been using IIS a lot more for testing too. I find that any inconsistencies that occur after deployment as a result of putting the app on IIS can be discovered earlier by using IIS in the first place to do the development.Methanol
L
4

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).

Legal answered 26/8, 2009 at 15:6 Comment(0)
D
15

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.

Darksome answered 19/1, 2010 at 23:2 Comment(3)
I had enabled Edit & Continue and it shut down Cassini when I stopped debugging. I'm running x64 - maybe that's what makes difference. @Darksome - were you running x86 or x64?Predigest
I thought it was stopping a debugging session that was causing cassini to shut down. But I think it's actually editing a file that needs to be checked out of TFS which causes the project to be reloaded that's the real culprit.Parfleche
The same as mco happened to me: enabling Edit and Continue does indeed stop Cassini when I stop the debugger. I am on VS2010 x64, don't know if this will apply to VS2008 (as per original question). This helps a lot with Entity Framework based apps, that keep a connection open to the DBMS, when you need (at early stages of the development) to drop the whole database quite frequently.Melonymelos
L
4

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).

Legal answered 26/8, 2009 at 15:6 Comment(0)
F
0

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.

Fell answered 27/9, 2012 at 7:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.