I am having problems debugging my web applications.
When I try to Debug my website I get an error saying:
The system cannot find the specified file
Now when I try to Debug again, there will be no error and it tries to open the page, but it doesn't load because IIS is not on.
And when IIS is on and I press the debug the page loads fine, but it doesn't hit the breakpoints I set.
Also the start button doesn't say "Google Chrome", but just "Start"
I thought this was only with this project, but this also happens in my other ASP.NET MVC Project.
I've tried restarting Visual Studio and my laptop, but that didn't solve it either. I also tried cleaning and rebuilding the solution.
Has anybody experienced this problem before?
Your problem with the Debug button showing "Start" occurs only if you set the Application Startup¹ to:
a WPF project or
a WindowsForms project or
a ClassLibrary project or something like this.
Otherwise, your WebApplication project or solution needs a review. Did you check these files?
If not, check the configurations.
See the Start Action in Web as the image below².
Another tips I can give you is to always Build your project during coding to see if everything is OK and sometimes do a Clean Solution and Rebuild it.
When something is not correct, try restarting your Visual Studio or disabling some extensions.
Also, here are a few questions to help you too:
F5 or Start Debugging Button is Greyed Out for Winform application?
Error while trying to run project: Unable to start program. Cannot find the file specified
Some of the answers even when not accepted can help you clarify why did you get this issue.
Hope this can be useful and I am glad you've solved the problem. Now, try to understand it.
--
You can set the Application Startup project by right-clicking the project in the solution and then click "Set as StartUp project".
To view the Project Properties as shown, right-click the project in the solution and then click "Properties" or select the project in the solution and use the shotcut ALT + ENTER.
Related
I have a multi-project solution that I was building in Visual Studio 2013 and it was working fine but now that I have upgraded to Visual Studio 2015 I can no longer hit break points in debug mode for any project exect the main project selected as the Startup project in the Project Properties page. I used to be able to click on the other projects and just choose Debug -> Start New Instance. I am getting the error The breakpoint will not currently be hit. No symbols have been loaded for this document. I have tried a lot of things found on Google including:
Clean/Rebuild
Delete the OBJ and BIN folder form the projects
Did VS repair
Rebooted
Uninstalled/Reinstalled
Confirmed Define DEBUG constraint is enabled for Properties -> Build
Confirmed Optimize Code is unchecked for Properties -> Build
Confirmed Properties -> Build => Platform target was set to Any CPU for all projects
Tried running VS using "Run as Administrator"
Deleted all the files in /AppData/Local/Temp/Temporary ASP.Net Files/
Made sure Debug -> Attack to Process -> Select had "Automatically determine the type of code to debug" was selected
Made sure the Properties -> Web -> Debuggerts had ASP.Net checked (my properties has ASP.NEt and Enable Edit and Continue Checked, Natvie Code SQL Server and Silverlight unchecked)
Confirmed Target framework in Properties -> Application was set to the same version (4.6) as in the Web.Config/App.Config files.
So what am I missing here? Why can I no longer debug the other projects?
I had a similar problem, when I created a new build configuration. After hunting around settings in VS2015, I noticed that there were no *.pdb files in my build output. Obviously, debugging would not work if there were *.pdb files.
The fix for me was to go into every project's properties -> 'build' page -> click the "advanced" button at the bottom of the page -> In the dialog's 'Output' section, I set "debug info" to equal "full".
Basically, I created a new solution and project and copied all the build properties into the solution that the debugger was not stopping at break points anymore. In addition to the setting above, I also changed the following setting to match the default debug settings:
I set on the same advanced page "Internal Compiler Error Reporting" to "prompt"
In the main 'build' page, I checked in the 'general' section "Define DEBUG constant" and "Define TRACE constant"
I solved this problem when checked Options->Debugging->General->Suppress jit optimization on module load. Before I did that I have also unchecked Tools->Options "Projects and Solutions" "Build and Run" "Only build startup projects and dependencies on run". Don't know if that has any reason why it works after suppress jit is unchecked.
My situation was that I have enabled "Optimize code" in the project properties.
If you only hit breakpoints in the startup project:
Tools > Options > Projects and Solutions > Build and Run
Uncheck Only build startup projects and dependencies on Run
And here it is in German:
Running the VS command prompt as admin as running the command: devenv /setup fixed this for me.
I never figured out what happened but I ended up building a whole new project and just importing the files into it and everything works now.
This sent me insane, until I realised in another solution I set to release configuration, changing it back to debug worked.
This probably isn't your particular answer, but thought I would share it "just in case" someone else gets driven to distraction by something obvious!
The debugger wasn't hitting breakpoints for my ASP application after migrating from my old system to my new system. I forgot to configure in IIS for debugging.
To configure IIS for debugging:
Sites > MyWebsite
IIS > ASP > Debugging Properties
Set Enable Client-side Debugging to True
Set Enable Server-side Debugging to True
In my case I just changed the setting of my running mode.
Before, I used "release" running mode:
And now, I'm using "debug" running mode:
I just fixed this issue for one of our front end developers. It may or may not apply to you. We use IIS Express for local debugging, and somehow his had become detached from the correct process when debugging.
To fix, I checked what process ID it was attached to according to IIS Express (right click IIS icon on taskbar, select Show All Applications, check the PID listed for the application). I then attached it to the proper process (with the solution running in VS, click Debug on the toolbar, select attach to process, find the correct process using the PID gotten above from IIS Express). Hope this helps someone.
I was never able to get it to work with the above methods and finally rolled back to VS 2013 for the solution which worked fine. It is very upsetting that VS2015 feels much like VS2005 when it moved from the stable robust VS2003.
I hope 2017 resolves these inconsistencies.
You may leave everything as-is, just take care of the following:
Advanced Compiler Settings -> Generate debug info -> has to be either "pdb-only" or "full"
Advanced Compiler Settings -> Enable optimizations -> needs to be UNCHECKED
I was also facing this issue but after Visual Studio 2015 Update 1, its now fixed.
https://www.visualstudio.com/en-us/news/vs2015-update1-vs.aspx
Restarting Visual Studio worked for me.
I hope this helps anyone. If you are running code in your local machine under IIS, you need to attach your solution to the w3wp.exe process. So, select your project, on the menu go to debug->attach to process and in the list you should see w3wp.exe
Now, if you don't see w3wp.exe you might either select the show all processes checkbox, or go to your IIS Manager and browse your web site in order to actually run the w3wp.exe instance.
In my case I was unable to debug because I had breakpoint set in source control temporary file while analyzing file history instead of actual file in solution.
My project was an MVC web app, and when i was running the project with debugger, a new tab was opening in browser which was redirecting me to login page. But in another tab i had logged in user which could do anything, but it wasn't hitting the breakpoints, even though i was hard refreshing the page. And every time i was closing the newly opened tab that was redirecting to login page. Once, i closed old tab with logged in user and actually logged in to app again in the newly opened tab. Then it started to hit the break points.
uninstalling postsharp nuget solved my problem, it is explained in this post https://doc.postsharp.net/uninstalling
I have a solution with a web project (the "main" project - lets call it the DataPortal project.) where the project will not open unless take the following steps.
Open solution. The DataPortal project is greyed out and says "Unable to open project".
Right click the DataPortal project node and choose Edit DataPortal.vbproj
Change the UseIIS node in the project from True to False. Save the file.
Right click the DataPortal project and choose Load Project. The project loads.
Now open the DataPortal project files Property page. (Alt-Enter)
Check the option button in the Property sheet that says Use Local IIS Web Server.
Check the checkbox that says Use IIS Express. The Project Url already has a value in it.
Now everything works great. And I can work until I shut down VS but when I re-open the solution I have to go back through it all again.
Can anyone tell me how to fix it so that UseIIS is okay at startup? Is there some way to get insight into the project load error for more information about it?
Maybe you could try to start Visual Studio with the log switch and see if it reports anything.
devenv.exe /log
(/log documentation on msdn)
Also, when Visual Studio behaves strange I usually delete both *proj.user and *.suo files and sometimes it resolves the issue.
Try deleting (or editing) your DataPortal.vbproj.user file. I had this problem a few days ago, and I think that's what I did to solve it. Project settings that aren't team shared (which may include run settings for your web app) are in this file.
Probably you have some problems with IIS port.
Try to diagnose using Fiddler or looking into IIS logs...
I have a web project in Visual Studio.
When at work i can start the project in debug mode (F5), and set break points. Edit the Code Behind or asp controls. When pressing F5, this will refresh and my new code will be represented.
At my home computer i can edit, i can press F5, but my changes will not be shown. And the debugger will step through the code like it does not realize that it has come some new code.
Has anyone experienced this before? This is not the first time I have seen this, but i cant for the life of me figure out how to make it refresh....
Any pointers will be welcome :)
Edit:
Could this by any chance have something to do about the project type? Or the compilation of the web project?
I figured out why this worked as it did.
The project type i had chosen for my project was ASP.NET WEb Forms Application. This implies that the project will compile and be run from an DLL file.
To rebuild this everytime there is made a change is not possible, so it doesn't.
I changed the project type and buildt a Web Site instead. This kind of project does not compile into a DLL, but is rather run on the fly from the files that i code. Because of this i can make changes to my files, hit f5 and it will automatically reload with the new content.
Okay , weird things are happening to me again. This morning when i started my ASP.NET application, worked on it a bit and now when i try to publish it. I'm getting served with an error where i can't seem to find any documentation on
Error 1 Unable to apply a change while debugging. Source file '\Properties\AssemblyInfo.cs' was reloaded. You must restart the debugging session.
Anyone knows what to do with this ?
Confirm that neither this instance of visual studio nor another is debugging the binaries in question.
Restart Visual Studio. This will usually fix the problem.
If that still doesn't work, try disabling all addons and restarting visual studio one more time.
Finally, as a last resort, reinstalling visual studio has a way of fixing seemingly unfixable problems.
You can try closing the ASP.NET Development Server. It will be in the system tray (next to time), just double click it and click "Close" then just run again.
Or you can open Task Manager and end the process of Image Name: WebDev.Webserver...
I have a Click Once application (WPF) in C#. Initially when I would hit F5 to debug/launch the application it worked smoothly. Eventually, F5 only would build the solution and not launch the application (therefore I could not step through my code). For a short while I switched from Debug to Release mode and for some reason that allowed the application to launch after using F5 and I could step through my code again. But now that no longer works either. Long story short, I cannot get the application to run in a manner that allows me to step through the code. I can only do a Start without Debugging (Ctrl + F5). Obviously this doesn't do much for me other than tell me if the application works or not.
The thing that worked for me today was to open Task Manager and look for any debug programs that didn't terminate properly.
Task Manager > Processes > kill all programs "*.vshost.exe *32"
You probably have lost your start up project in the solution, or the start up project is messed up, and no correct "item" is defined for the startup.
Right click on one of your projects, and select : define as startup project.
Then retry that should do the trick. If not, check in that projects properties to see if a form or something is defined as the startup object for that project.
Edit : Obviously dont define a class library project as startup project, but choose your UI :).
I had this same issue today and came here looking for help. I tried all the suggestions here and nothing helped.
Seeing as my solution was a simple console application I recreated it from scratch. The new solution didn't exhibit the problems, so I started comparing the two.
I reset the solution and project files so that they were identical (apart from Project GUID, name and root namespace) but the first solution still didn't run.
I then tried deleting the suo files, and the bin and obj folders. Still the first solution wouldn't run.
Finally, I noticed the vshost.exe process was still running for the project. When I killed that and reloaded, it all started working correctly.
I just had this problem today. The solution turned out to be a slight twist on the issue with *.vshost.exe mentioned previously.
I could build the application just fine but msvs refused to launch it. I could manually launch the application and the time stamp on the file indicated that it was in fact a fresh build as well. *.vshost.exe wasn't showing up in the task manager, so I couldn't end the process as suggested.
When all else failed, I tried deleting the .exe's and found that *.vshost.exe would not delete because it was in use. The error message indicated that it was actually the steam client (third party software) that had somehow grabbed my *.vshost.exe file and was "using" it. Not sure how or why. At any rate, I completely shut down steam, then it let me delete *.vshost.exe. After that, building and running from msvc worked normally.
Had the same issue, eventually tried deleting all breakpoints and the debug started working again. Yet to figure out why, but at least it works.
As well as the ghost *.vshost.exe. It could also be that you have the same Solution/Project open in another version of VS. I had the same Solution open in both VS2010 and VS2015 and when running in VS2010 it compiled but failed to start. Closing the VS2015 Solution and it ran as expected.
After years of using VS 2008, I suddenly had the F5 problem not launching the application. There must be a dozen different suggestions out there - I tried a few. Someone suggested a virus. My Microsoft Security Essentials was not automatically updating (a common problem it seems), so I manually updated it. It found a virus, removed it, and the F5 problem went away !
Had this problem and tried to delete everything in bin/debug folder but could not delete vshost.exe file - kept requesting admin permission and then still could not remove it even though running from admin account. Restarted and file was gone and f5 worked again