Why is debugger not running? - visual-studio-2010

I have a solution which contains the following:
Website Project (using local IIS 7
server) with a Default.aspx page
Console app (sends request to Default.aspx page in Website Project
When I place debug points in the Default.aspx page and run the console app, the debugger does not start. I know the code in there is executed because it returns the proper response.
Why is the debugger not working?

You need to start the web project from within Visual Studio or attach the debugger to the running process before starting your console application. I'd recommend the former.
Then when you start the console application your break points should be hit.

Related

Why does UiPath robot runs in Debug mode on Chrome in a Test Automation project?

I have created a new project in UiPath Studio Community Edition v.2021.10.4, and created a new 'Test Automation' project. And created the steps to open a browser, go to specified address and type in login/password and click OK button.
The issue is when I try to run the script that I created not debug, it runs on debug mode in Chrome, and this navbar pops up in Chrome which says : UiPath Web Automation 21.10 has started debugging this browser. , and when it ends the browser closes automatically :
What I want is to execute this script normally, not in a debug mode, and the browser stays open, so I can implement the next steps in my developments.
I managed to solve this by changing the input method of the Activity "Use Application/Browser" from Chromium API to Hardware Events.

VS 2017 always times out debugging an MVC Core website on IIS Express profile

On a plain vanilla, scaffolded ASP.NET Core MVC web app, with a DbContext registered in the DI container, whenever I hit F5 after 30-60 seconds, I get the error message:
Unable to start program 'http://localhost:60175/'. Operation timed
out.
The home page in an index view, whose action gets all employees from a localhost SQL Server db. The project is already built, so the initial build for debug is quite quick, and doubtfully the cause of the delay.
If I run without debugging, I get the home page up in 30 - 40 seconds.
Just what is timing out, and can I set that timeout? Or is there anything else I can to to speed up this painfully slow debugging setup, compared to MVC 5, where the home page opens after only a few seconds.
It is hard to say if it is the same issue, but I had same symptoms when I was starting my current project. In my case, I found I either had to:
Turn off Browser Link; or
Use a browser other than Chrome as the startup browser.
It wasn't until I selected Microsoft Edge as the browser in the debug button of the toolbar and it worked fine that I realised what it might be, and I disabled Browser Link. It all starts up fine now.
If it is yet another issue, then best of luck.

VS2013 won't debug a specific web application

I have a web application that uses IIS, but when I try to debug it VS just locks up and gives me the hour glass cursor icon. No browser window opens, nor does an instance pop up in the Task Manager. VS says its Running / not "Not Responding", but I cannot interact with the IDE. Can't Ctrl-Break to stop or anything.
I was able to run it before, and I'm not aware of any system or IIS changes that could cause this. I've disabled source control and I've tried launching the app in both Chrome and IE but it still behaves the exact same way as described above.
Has anyone else encountered this? The only threads I could find just describe general slowness in the IDE but otherwise its functional. The recommended fix was to disable the source control functionality, which as I said I already tried.
I should note that I don't seem to have an issue running & debugging winforms applications. I also just created a web application and was able to launch it in Chrome and get to the homepage. Also, it doesn't make a difference if I have a breakpoint set or not.
This solution has 4 different projects. If I set a different project as the Startup Project, it does run and launches the browser but it just gives me a 'file explorer' sort of view where it just lists the files in that project's directly which is obviously not what I want.
Edit; If I manually open a browser tab, try to navigate to http://localhost/myApplication, VS pops up and asks if I want to attach process w3wp.exe to IIS APPPOOL\myAppPool. If I attach, it opens a new tab in Chrome and my application runs. But unless I do these 2 steps, it does not run.

Configure Visual Studio to break when any managed code is hit

I am spinning up an ASP.NET website from Visual Studio for debugging purposes. I am unsure of the entry point for a given action, so I would like VS to break as soon as any managed code it hit (thus showing me the entry point!). How can I do this?
You can try to launch the app using F10 rather than F5. This will show you the starting point of the web app bootstrapping process. Another thing you can do is to let the app start as usual (F5) and then detach from the browser and pause the app before clicking anything in the browser.
Unfortunately it will stop deeply in the ASP plumbing code. To get to the app code will still take some digging
You can place breaking points on selected patrs of your code

How to shutdown local tomcat server when closing browser window?

I hava a web app running on a local tomcat server.
When the user starts the app (via desktop shortcut) the server starts and the app is opened in a browser window.
But when the user just clicks on the close button to stop the application the server is still running in the background - that's annoying.
I tried to utilize the "unonload" and "onbeforeunload" events from javascript but unfortunately these events are also fired on some other requests in the app.
So I can't use them, except I do a lot of refactoring.
Does anyone have an idea for a possible solution?
Btw, what I find interesting is the behaviour of Visual Studio when debugging a web application. When I close the browser window Visual Studio also gets a trigger to stop debug mode. So it seems it somehow notices the close event of the browser window, which would be exactly what I need. But I don't know how they do it...
Can you wrap the starting of Tomcat and launching your app in a batch file or shell script? (Not sure what your target OS is...)
The script/batch file would start Tomcat and then launch your application. When the user exits your application, the script/batch file would then shut down Tomcat.
You can setup a short session timeout, and use a HttpSessionListener. On sessionDestroyed(..) you can stop tomcat (using catalina.bat for example) .
Otherwise you can try to detect browser close, and send a shutdown message to the server using ajax (before the browser is closed).

Resources