breakpoints in code behind not hit - asp.net

common problem I guess, but no solution has worked so far:
my breakpoints (asp.net 2.0) get hit nicely in "backend" assemblies but not
in the code behind.
i can even see the
<% Response.CacheControl="no-cache"; %> line being hit in my asp.net master file
but still not the code behind.
I'm using VS 2005, windows 7 32 bit.
Any idea what else could I check?

If your code file is newer than the compiled version that is being run against (on the web server, whether it be IIS or the dev server), breakpoints will not be hit (the red circles will be hollow).
Try doing a clean / rebuild and see if that works.
EDIT:
I just noticed something in your last comment; you said you are attaching to the asp.net process. To which process are you attaching? It should be w3wp.exe.

My problem ended up being that I'd created a new configuration for the project, but that none of the debug properties on the project were set for it. So this is what I had to do:
Right click the web project and select Properties.
Go to the Build tab.
Click Advanced.
In the dialog, ensure that in the Output section, Debug Info is NOT set to none.

I'm guess there is a problem in loading the symbols for the page, and hence the breakpoint is not hitting,
try this
1 - While debugging in Visual Studio, click on Debug > Windows > Modules. The IDE will dock a Modules window, showing all the modules that have been loaded for your project.
2 - Look for your project's DLL, and check the Symbol Status for it.
3 - If it says Symbols Loaded, then you're golden. If it says something like Cannot find or open the PDB file, right-click on your module, select Load Symbols, and browse to the path of your PDB.
4 - I've found that it's sometimes necessary to
stop the debugger
close the IDE
close the hosting application
nuke the obj and bin folders
restart the IDE
rebuild the project
go through the Modules window again
Once you browse to the location of your PDB file, the Symbol Status should change to Symbols Loaded, and you should now be able to set and catch a breakpoint at your line in code.
hope it helps !
Answer source

Ugh. In my case I had mapped the right folder in IIS, but the application was set on IIS Express.
So the correct assemblies where loaded when I went to the URL, but the application was attached to a IIS Express version that never got any hits.

In my case I updated my repo from Git and the Project changed from Local IIS to IIS Express (Project > Properties > Web tab). This somehow messed up my configuration and I was not able to debug.

My problem was fixed by setting it to "Startup Project"
Solution Explorer -> Right Click on the project -> Set as StartUp Project
or
Menu bar -> PROJECT or WEBSITE -> Set as StartUp Project

Just to help others who come across this question, I too had this issue where none of my breakpoints where being hit.
It turned out that the project was originally created in Visual Studio 2015. I have 2008, 2010, 2015, 2017, 2019 installed. I accidentally opened it in 2017 and then this issue occurred. Opened it back up in 2015 and back to normal.

Related

Process with an ID of #### is not running. output says: "The program '[4560] iisexpress.exe' has exited with code 0 (0x0)."

so I was previously using VS2015 in Windows 10. I had built one simple ASP.NET MVC project and never faced any issue while running it. However, I have been using Windows 8.1 now and installed VS2019. Running the same application and been facing the error "Process with an ID of #### is not running".
output says: "The program '[4560] iisexpress.exe' has exited with code 0 (0x0)."
So I tried to open a new dummy ASP.NET Web MVC project to check if that works and it didn't.
Now, there are a myriad range of solutions provided all over and I have tried every last one of them. With no luck.
1. Delete the hidden .vs file.
2 Rename/ remove the IISExpress folder and its config file under documents.
3. Removed the specific code snippet from the solution .csproj file
4. Of course tried running VS as ADMIN.
5. Realised that IIS exress was not installed. So completed that.
6. Then realised that VS 2019 needed to have the IIS support for ASP.net core installed additionally, so done that.
Now I'm out of ideas. It would be really helpful if you could provide some more suggestions or work arounds for this problem.
Thanks.
So, what finally worked for me were the following steps:
Install IIS using this link -
IIS Manager in Windows 10
Run the IIS from command line by following this link -
https://learn.microsoft.com/en-us/iis/extensions/using-iis-express/running-iis-express-from-the-command-line
Opened VS 2019 in admin mode.
Project -> (right click)Properties -> Web -> Servers -> Select local IIS from dropdown. -> Create Virtual Directory -> click ok. -> ctrl+S
Run the application.
I was getting same issue. This problem can be resolved by explorin project directory and remove the .vs hidden folder.

IISExpress shows up as host for browser in Visual Studio and messes up everything - how to get back to local?

All of a sudden after I installed Microsoft Edge on Windows 10 gd, Visual Studio is using IIS Express when debugging a web application and it is messing up everything.
How do I get back to normal, so that stupid IISExpress is not used anymore?
Go to the project settings and on the web tab is a drop down that allows you to choose which engine to use.
I went to Project > Properties > Startup Project and then set my start up projects to start the services I need and my project. This reverted my button back to just "Start".

Unrecognized attribute ‘targetframework’ when debugging in Visual Studio

Although there are several questions and answers about the "Unrecognized attribute ‘targetframework’" error, the other questions mainly have to do with errors deploying to a server, and so the answers show IIS 7 settings that need changing. In my case, I was getting the "Unrecognized attribute ‘targetframework’" error when trying to debug in Visual Studio.
I manually modified my web.config file to upgrade it to 4.0, as described in this MSDN article. That included adding the targetFramework attribute to my compilation tag, like this:
<compilation debug="true" targetFramework="4.0">
I did this because I wanted to use an assembly that targeted the 4.0 framework. But then when I tried to debug the site, I received the "Unrecognized attribute ‘targetframework’" error. As I mentioned, the solutions that I found all talked about changing the application pool in IIS 7, but I was just trying to run the site in the Visual Studio debugger. I tried looking at the Properties for the Solution, but didn't find anything about the framework.
I had the same problem....
I cloned a solution from MS Source safe, open the solution in VS 2015.
Tried to register the dot.net framework 4.0.... nothing worked....
The solution for me:
go to project settings-->Web change the IIS express port http://localhost:59563/ to something like http://localhost:59569 or check the Override application root URL
It took me a lot longer than it should have, but eventually I found the other Properties dialog I was looking for. It wasn't in the Solution Properties, but was in the site "Property Pages", in the Build section.
To open the Property Pages dialog, you can do any of these:
go to View > Property Pages, or
go to Debug > [My Site] Properties... (last item in Debug menu), or
Right-click on the Web Site in the Solution Explorer (2nd item in Solution Explorer, under the solution itself) and choose Property Pages
Then in the dialog that pops up, click the Build section on the left. The right side will then contain a drop down box for "Target Framework". When you change it to 4.0, Visual Studio will warn you that the project will be reloaded. After that, it will debug properly.
I encountered this issue when I used the Visual Studio interfaces to change the .NET version but then reverted the changed files. To resolve, I closed Visual Studio and deleted the .vs folder from the project. Visual Studio rebuilds this with the appropriate information when the project is rebuilt.

What sets the type to "Managed" when running web services under IIS Express?

As per the question, how do I configure an ASP.NET MVC project when running from Visual Studio 2013 under IIS Express (x64) to be seen as a "Managed" type in the debugger "Attach to Process" screen?
My solution always used to allow me to debug the web projects when running, and now I can no longer do so as the projects all seem to run as x64 non-managed.
I'm guessing it's something I have changed under the csproj or MSBuild targets / properties.
Regards,
Rob.
In the end, it appeared this was a combination of bloated csproj files, coupled with instability in Visual Studio 2013.
If you are using Visual Studio 2013, I highly recommend installing Update 2. It appears to make tasks a lot more reliable.
I never figured out what governs the Managed setting, however I have found the following option:
Click Attach to Process
Underneath Transport/Qualifier/Transport Information, there is a box marked Attach To:
By default, it is set to perform Automatic selection.
Click the Select button.
Toggle from Automatic to "Debug these code types"
Tick one or the other (not both) of the entries for "Managed ([.NET version])"
Click OK
I have had some success in getting the Debugger to attach properly to the IIS Express processes that are running Managed debuggable code that it "automatically" doesn't let me (for seemingly random reasons).

Not able to run Visual Studio Project

Hi I don't know what I did, when I try to run visual studio project by pressing F5, I can see only loading symbol in browser but not displaying anything. When I checked whats going on, I got to know it is running on IIS Express and not on ASP.net development server.
What changes I should do to make my project to run on ASP.NET development server?
In the properties of your web project you can see the start options which has a server option.
Also if you right click your web project you can see option to use IIS express or dvelopment server.
Don't worry , this is not big issue .
Just open your csproject file into notepad.
And find this line in your csproject
<UseIISExpress>True</UseIISExpress>
Then change True to false
<UseIISExpress>false</UseIISExpress>
And save that ,then you can run your project .

Resources