Chrome won't load pages after Stop Debugging in Visual Studio - asp.net

If I F5 to debug, and browse to my test site using Chrome, and execution halts before sending a response (e.g. we get an exception and I click Stop Debugging instead of continue to the end), that Chrome window and any child windows it spawns will no longer work with the project. It will say "Loading" with the spinner in the tab, the window will be empty, and it will stay like this apparently forever. Alternately, in a new tab, I type the URL and hit enter and it does not display any loading behaviour as though it isn't even trying to load it. This persists across tabs within the same window hierarchy.
My workaround is to create incognito windows in Chrome when testing local sites. If it gets into this error state, then I have to close the window and open a new incognito session from the original browser parent. If I accidentally cause this problem in the main window, I have to fully close Chrome to proceed. Using different Chrome profiles also works as I assume it's a different top level process.
Otherwise, it does seem to calm itself after quite a while - 5+ real life minutes or something similar it will revert and start working again and the page will load if it was still trying. But is there a better solution? This is VS 2022, debugging ASPX/C#, using a hosts file for local.site.com domains and separate http/https ports.
Edit: Image to show settings page

Your issue is rare, we need to troubleshoot step by step. First, please confirm that Tools==>Options==>Debugging==>General==>Enable Edit and Continue is enabled. Then you need to use detach all instead of stop debugging.

Well, if you hit a break-point in code behind, then code has haulted, and no more web pages can be dished out. (this is standard behavour when using the built-in web server that launches by hitting F5. if you close the web page, then the web server shuts down, debugging stop, and you back into Visual Studio.
You could try hitting ctrl-F5. That runs the VS site as non debug mode, and break-points etc. thus don't usually get hit. But, f5 STARTS a copy of IIS express web server. You close that web page, then debugging stop, IIS is then shut down. This is correct behavior's.
If you want to start testing the web site with say NOT having a debugger tied to the web site, then you probably are better off to install + run IIS full edition, and not the Express Edition that is "tied" to VS and the debugger.
So, the instant you close the browsesr, or even hit the "stop" button in VS, then IIS is shut down - it is stopped each time.
However, you could/can give ctrl-F5 a try - that will launch your site as non debug mode (and you not that no stop button is highlight).
IIS "express" is a great setup for f5, step code, debug code. However, the instant you want to start testing the site, and not having launched it from "inside" of VS? Then you probably should setup a VM with the full edition of IIS, or even I suppose install full edition of IIS on your computer (I not done that, since I have a few VM's, and I don't want to "mess up" my developer box with having a full pop full edition of IIS installed on my computer.
So, if you want "others" to test the site, then setup a VM with server 2019, or whatever, and then install IIS full edition. This THEN gives you the full GUI and setup features of a web server - which is a good learning experience.
So when using f5 to debug? yes, a halt in code will halt the ability of the web server to dish out other pages. In effect, IIS process one page at a time, and when the page life cycle is done, the the next page/request can be processed.
So, if you want "more" then this setup, then you probably need/want to get a full blown full edition of IIS up and running. And I suggest that should be placed on some other computer then your dev box, or at the very least in a VM on your dev box.
You "can" sort of get IIS Express edition to be launched and running outside of a VS debug session, but it is painfully, since you don't have the GUI and all of the web configuration tools that the full edition of IIS has.

Related

Visual Studio 2017 release 15.7.3 does not launch application successfully

I have a fairly standard web application with a single HELLO WORLD aspx test page, so for the purposes of this question, that is the start page.
When I run the app from visual studio by pressing f5 I get "Cannot reach this page" or whatever the 404 equivalent is in each browser. (chrome: "this site can't be reached"). In firefox, the page runs successfully first time, firefox doesn't have any debugger attachment add ins, so the problem seems to relate to debugger attachment in IIS express
If I wait a few seconds, and then F5 the browser (IE or chrome), the expected page loads successfully, so it seems to be a delay in IIS starting when a debugger is attached.
I'm wondering if anyone else has hit this and whether they have a solution. We have a quite a few tweaks in web.config to meet high security needs but otherwise I can't think why it would go wrong.
Workaround is to wait a few seconds and press f5, but thats kind of annoying when you're trying to get on with things.
As described by O.H., and verified by user2728841, the solution for me was:
Tools > Options > Debugging and changing "Enable JavaScript debugging for ASP.NET".
However, opposite to O.H. and like user2728841, my option was deselected, and selecting it solved the problem.

ASP.NET Web Application Productivity in Visual Studio 2010

I'm working on a fairly large ASP.NET web application and I'm taking a big productivity hit when I do work in the interface. I can zip through adding features to the database and API, then I hit the interface and having to recompile and run eats up a lot of my day.
For example if i'm working on a tricky bit that isn't behaving quite right and requires a number of tweaks I'll have to go through multiple [stop/tweak/build/run/log in/navigate back to page] cycles, which really kills my flow and has me staring at the screen with my finger hovering over the hackernews bookmark each time.
I've been fiddling with ways to get around this problem but I haven't improved my situation much. Here's what I've found so far:
visual studio will restart the app frequently when you change static files (js/css/etc), which shouldn't require a restart. If you run VS with IIS express instead this problem goes away.
If I know I have a bunch of messing around to do i'll cut/paste my code into a server script tag on the markup page, run the product, and tweak until it's good, then cut/paste it back. This is annoying because it often requires setting up a number of Imports page declarations and code editing features in ASP.NET files, while better than ever in VS2010, is not as good as in C# files. Plus, it still restarts the app occasionally once enough changes are made.
I can exclude the codebehind file from the web application project, change the "codebehind" attribute in the aspx page declaration to an "src" attribute, then edit the code from there while the app runs (until i make enough changes to trigger a restart.) However now intellisense doesn't work in the codebehind, among other things.
Am I missing something blindingly obvious here, or is development in ASP.NET web applications really supposed to be this slow? Thanks for any solutions you can offer.
I never run my applications through Visual Studio. Set yourself up with IIS and then configure a site to point to the location of your application along with a faux domain. Edit your hosts file to point the domain to localhost.
Then when you want to view your site, just visit the domain that you chose. If you need to modify CSS or script, just make your changes and refresh the page. If you make a code change, compile your app and then refresh the page.
If you need to actually use the Visual Studio debugger, then just attach to the IIS process (application pool name) and your breakpoints will get hit.
I've found a combination of techniques that brings my productivity up a fair bit.
Use an alternative browser like Chrome. When you stop the VS debugger and you're using IE, VS will shut down the browser, but it won't do it with Chrome (or Firefox, or anything else.)
Switched web.config to run in Windows Authentication mode and wrote a quick transparent login routine enclosed in conditional compilation tags (debug only, this feature is not perfect for our production product.)
Now when I'm getting into it I can stop the debugger (which no longer closes the browser,) make code changes, build, optionally start the debugger again, and just hit F5 in Chrome to load the latest. The refresh obviously takes longer since the app has to start up but there's no "run browser/log in/navigate back to the page" task anymore.
Hopefully this will help somebody else in a similar situation.

How to remove visual studio's popup "Choosing to wait for a request..."

I have a project that has, amongst other things, one web application (mvc) and one WPF application. For the part that matters, the WPF app connect to a WCF service hosted on the website.
What I want to achieve is that when I press Ctrl+F5 (start WITHOUT debugging), the build process kicks in (if needed, in other words, the default VS behavior), the WPF app launched, and if the webdev server is not launched, that it get launched too, but without opening any page on my browser (I'll manage that myself).
I managed to get that working as I want (configuration below), but every time I do a Ctrl+F5, I get a popup from VS that says
Choosing to wait for a request from another process without enabling
ASP.NET debugging results in nothing to debug.
I value the information, and that seems to match pretty much what I'm trying to accomplish anyway, but now, instead of having to close a useless tab in my browser, I have to close a modal dialog. Not a big improvement from my point of view.
So, how do I prevent this popup to show up ?
Additional information:
I don't want to start in debug mode (F5). If I need debug for the website, I'll do my usual (attaching to the webdev server).
I want the webdev server to be running all the time from the first CTRL+F5.
I don't want to publish it on IIS (even the express version)
The solution startup option is set on "Multi startup project" with the WPF app on "Start" and the website on "Start without debugging" (setting it on Start doesn't change anything, except that I also get the popup when debugging with F5 directly).
The website has its start action configured on "Don't open a page. Wait for a request from an external application". The ASP.NET checkbox in the Debuggers is checked.
Internet had not been a big help so far, so all my hopes lies on you SOers !
Edit
It seems that it was flagged as a bug, but I don't see any reference in what version it's supposed to be fixed...
Also, I discovered my question is a duplicate of this one.
I actually found another way : in the start actions, you can set it to "start external program" and reference a self quitting program. I used "C:\Windows\System32\PING.EXE". Not perfect, but also less annoying than the previous solutions.

"Advanced" Edit and Continue?

Alright, I've been searching forever and can't find the answer to this.
So on my work computer I run Windows 7 and Visual Studio 2005. I have a ASP.NET project (2.0) and let's say I hit F5 and start debugging. Now, once a page is done rendering I can edit the content or the codebehind code of the page without it throwing any error messages (just like if the project was stopped). Then if I save the file and hit refresh on the current debugging browser, it'll take a minute to recompile the project automatically and then refresh with the recompiled code. I can ONLY change the code in the ASP.NET project, not any class libraries that the ASP.NET project is dependent upon. I can also set breakpoints and it'll hit them (so it's not like the debugger is not attached or something).
Now on my home computer, I run Windows 7 and Visual Studio 2010. I have an ASP.NET project (4.0) and let's say I hit F5 and start debugging. Now, it doesn't matter if the page it done rendering or not - I cannot change ANY of the code behind, although I can change the content. If I attempt to I get a message saying
"Changes are not allowed while code is running or if the option 'Break all processes when one process breaks' is disabled. The options can be enabled in Tools, Options, Debugging."
That being said, if I put a break point, refresh the page and hit the breakpoint THEN I can change the code and then hit F5 to continue.
So my question is - what EXACTLY do I need to do to get it to work like my work computer? It's REALLY annoying to have to stop the project or be clicking breakpoints all over to edit one little piece of code (especially when I'm so used to not having to do that at work). Is this some change in Visual Studio 2010 or something? From what I've read, how it's working at home is the real "Edit and Continue", but I can't figure out what to call it on how it works with my work pc.
Another difference (might be of help):
I set it up so that my IIS goes to the project folder, and then run the project outside of the debugger on both my work and home machines.
Now on my work machine I can make a change to the code and when I hit refresh on the non-debugged browser it'll do the same pause for recompile and then refresh the screen.
On my home machine if I make a change to the code and save it and then refresh the non-debugged browser it will not recompile the code.
So this makes me think it's some IIS setting in the end to make it auto-recompile? It clearly doesn't seem to have anything to do with VS since I'm not even going through the VS debugger to access to code at that point.
Just my thoughts: maybe you use on the work WebSite project, but at home WebApplication. In case of application all code will be compiled in the single DLL and changes should be recompiled first. In case of WebSite - each page compiles in different DLL and you can chage any of the page and it will recompile it.

Asp.Net Development Server shuts down every time I stop debugging

Using VS2008 on my local dev machine, when I run my asp.net Web Application project, it starts up a session of Asp.Net Development Server when I use F5 to run the app in debug mode. It all works fine and I can run my app for testing and such. Then, when I stop the running debugging instance of my app (by closing the IE window with the X close button, or by clicking the square Stop Debugging button in the VS IDE), the app stops and I return to the VS IDE, but it also closes down the Development Server session, and then, after I make a few edits to my code and want to run it again, it takes forever to launch up the Development Server again and serve up the first page of my very simple app.
Is it normal for the session of Asp.Net Development Server to completely shut down like this each time?
I only have 1 project in my solution, and it uses ADO.NET Typed DataSets and OLEDB adapters, and basic asp: controls in the aspx web form. Overall, it is a very small app.
I hate waiting 20-30 seconds each time I want to run my app just to see one tiny little code change.
I was also facing same problem, but in my case "Edit And Continue" setting was a culprit. Thanks for posting this.
If you don't need to debug every time, you can actually just open the URL outside of pressing F5 (press F5 once, copy the url, stop debugging, open it in a new browser). This way you can make any changes you want, recompile, and see it immediately. But as I said, it means you're not debugging. You don't always need to debug though.
A secondary option, is to run against IIS, and only attach to the process as needed.

Resources