Shutdown asp.net core application - visual-studio

I started to learn ASP.NET Core and cannot find a way to shutdown asp.net core application if it was started from Visual Studio by "Run without debugging"
If I start it from console by dotnet run it can be shut down by Ctrl+C
How I can find my running app and stop it when it was started from VS?

In your taskbar at the right, there'll be in a icon for IIS Express. Right-click that and you can choose to stop individual sites or IIS Express entirely. You may need to expand the system tray area to see the IIS Express icon.

Related

Prevent visual studio shutting down service fabric services

When I run my service fabric service in visual studio it deploys to the service fabric as expected. When I stop debugging in visual studio, visual studio then unprovisions the service fabric service.
Is there any way to prevent this behaviour? I would prefer it if visual studio left the service running in service fabric.
Thanks,
Slicc
There are two ways this can be done:
Launch your app from VS without the debugger attached (Debug -> Start Without Debugging [Ctrl+F5]). Obviously, this would require you to manually attach VS to your service processes in order to debug them. When you detach VS from the processes, VS will not remove the application in this scenario.
With your Application (.sfproj) project selected in Solution Explorer, go to the Properties window and change Application Debug Mode from "Remove" to "Auto Upgrade". This prevents VS from removing the application after debugging. However, it also causes another change in behavior in that it will automatically upgrade your application each time you launch it from VS. The added benefit of auto upgrade is that your application state will be maintained across multiple launches from VS. This may be desired or not. There is not a setting that allows you to both prevent application removal and not do an auto upgrade.

Can you prevent Visual Studio 2013 from starting all web sites in a solution when using IIS Express?

Is it possible to configure IIS Express to not run all the web sites in a given solution? I have a solution with 4 web sites and I only want IIS Express to run 2 of them when I hit Start (F5) in Visual Studio 2013. I have the solution set to only start 2 of them, the other 2 are set to None.
I went into the IIS Express config file and created a new app pool with autoStart="false" and assigned this new app pool to the sites that I do not want to run. I also set the serverAutoStart attribute to false in the site tags, that I don't want to run. These changes didn't make any difference. The IIS Express tray interface still shows all 4 sites as running. (Yes, I shut down Visual Studio and made sure all the iisexpress processes were dead, before restarting.)
Yes you can,
By default all sites has a property called "Always start when debugging" set to True
setting this property to false will allow starting only the specific site you choose to debug.
Try using the Disable Always Start When Debugging VS add-in tool.

How to debug two web applications/services on IIS from within Visual Studio?

In Visual Studio 2010,
I want to debug two web applications running on IIS at the same time.
When debugging the first application it is ok. But when starting to debug the second application and first program is still in debug mode, Visual Studio prompts:
unable to start debugging on the web server. a debugger is already
attached
How can I solve this problem?
To summarize, one has to set different application pools in IIS for the two applications to debug.
Here is a rough instruction, given that both applications have been deployed to IIS once within Visual Studio.
Open the Internet Information Services (IIS) Manager
Click Application Pools on the left pane
On the right pane add another integrated application pool, let's name it Second ASP.NET 4.0 Integrated
For one application, open the Advanced Settings...
In the properties view finally select Second ASP.NET 4.0 Integrated as the application pool
This way the applications should be debuggable in parallel because each Application Pool spawns a new operating system process to which a separate debugger can be attached.
A windows process can only have one debugger attached to it at a given time. If you get that message it means that you're attempting to debug the same process twice which won't work. But that also means you should be able to debug both web applications in the instance of Visual Studio that's already attached. It may require a few extra steps though to get it to acknowledge the other code
Disable "Just My Code" (Tools -> Options -> Debugger, uncheck "Enable Just My Code"
You may need to manually load symbols for the other web application through the modules window (Debugger -> Windows -> Modules)
After that though (second step may not be necessary) you should be able to set break points in both web applications and otherwise debug them.

Debugging Question - VS 2008 web services on Cassini

I'm testing a web service in Visual Studio, and stepping through using the debugger.
Then I click stop debugging. This stops the debugging session, but the program continues to run like a runaway train.
Is this a "bug" or a "feature" of Visual Studio 2008? If it's a feature, how can I tell Visual Studio to halt execution when I click on 'stop debugging'?
The web server that visual studio uses will keep running in the background. You should be able to stop it using the icon in the task bar.
Or if you have lots of instances running, my favourite little trick is to pop open the run command and type:
tskill webdev
When you run webservices, even when you stop them, they still run on the background, what you can do is look in the taskbar on the right hand side and close out the instances of the webservice that are running by right clicking on the icon and pressing stop.
While you've stopped debugging the application chances are that the asp.net developement server is running. you should be able to stop that from its tray icon

How do I keep the development web server (Cassini) running in Visual Studio 2008?

I'm using Visual Studio 2008 to develop ASP.NET applications. Currently I'm debugging with running on IIS. I would like to switch to the development web server (Cassini) for debugging, so that I can use features like edit and continue. The reason that I'm not, is because the development web server only starts up when you are in debug mode. Is there any way to keep it running all the time, and just have Visual Studio attach to the existing server process like it does with IIS?
Rihan is partially correct...
In your Project Property page, Web tab: Enable Edit and Continue
If checked - The Development server will close when the app (not VS) stops.
If unchecked - Development server keeps running
You can also start your cassini server from the command line which takes alot of pain out of the whole "debug" effort...
Check out a good snippet here on how to do this: https://thoughtjelly.wordpress.com/2009/05/13/launch-cassini-from-the-command-line/
Once started, the built-in web server continues executing even when you stop debugging, as long as your VS2008 project is still open. Just start up the debugger when you want to start debugging again. I typically have another browser window open and interact with the built-in web server from there instead of the browser window that it opens so I can keep working with the application in the same state even after turning off the debugger (which closes the opened browser window).
I'm running VS2008 on Windows XP SP3.
The simplest way I have found to acheive that is by launching the debugger as normal. Then in Visual Studio goto the Debug menu, and select detach all. It detaches from the Cassini web engine, but it does not shut it down, as it does when stopping debugging.
I am quite sure you are know that there is command line swithces that you can you use to launch the cassini engine, but my guess is you are looking for something slightly easier.
Detaching does not close the browser window that visual studio launched, and if you do close that spesific web window then it will stop debugging.
I am running VS 2008 SP1 on Vista 64x SP1 without IIS.
Hope it helps
Rihan Meij
I have 3 web sites, with Single sign on between each site so I need to start all 3 with attach to process. However, there was no process to attach the debugger to, and whenever I started a project with F5 then stop it, the visual studio web server closed.
The Enable Edit and Continue option didn't change anything.
So to start the web server and keep it running so that you can attach the web project to the process, I simply did a "view in Browser" (ctrl+shift+W). This started the server process but not the project nor the debugger. I could then attach to process easily.
In Visual Studio 2015 you do this by going to Tools > Options > Debugging > General and unchecking the "Enable Edit and Continue" option:

Resources