We are using Portable Areas in our ASP.NET MVC web application, and I notice that breakpoints are not hit in Views that are contained in the Portable Area.
So I can not debug Views in a portable area, which is sometimes needed.
What could be solutions to this problem?
Things I already tried:
Debug in VS2012 and VS2013
Clear temporary asp.net files
restart IIS
restart PC
Delete /bin/ and /obj/
Breakpoints in the controller ARE hit. Just not in the views so I suspect it has something to do with using portable areas.
I am having the same issue. Here is what Visual Studio explains about the breakpoint:
After disabling the option as suggested on the last line of the message I get this:
Related
I've got a problem while attempting to debug my ASP.NET MVC site in Visual Studio 2015. Don't think it matters, but it's a Sitecore MVC site.
I deploy locally to an IIS 10 website. I place a breakpoint on my cshtml view. I attach to the w3wp.exe process. When the proper page loads in the browser, Visual Studio opens up another tab that contains my view, but the path to it uses the 'inetpub' path. So instead of opening '\vs\code\mysite\views\myview.cshtml', it opens '\inetpub\wwwroot\mysite\views\myview.cshtml.' While both tabs are open, I can see that my breakpoint is only on the inetpub version and attempting to set a breakpoint on the 'local code' version results in Visual Studio switching to the inetpub version. (doesn't allow me to set a breakpoint on the local code version)
So, the breakpoint is still hit, but I don't have intellisense in my immediate window. After stopping debugging, I'm left with two tabs with the same view and have to figure out which one to modify before deploying again. Larger issue is that I don't have intellisense, but I suspect this is due to this issue of opening the wrong file. Note: I do have intellisense during the same debugging session for another library project that is further down the execution path.
Feels like a VS configuration issue, but I have been unsuccessful in locating what the issue might be. Anyone seen this behavior before?
ASP.NET MVC, Visual Studio 2010, C#/.NET4. I'm using IIS Express as the web server of choice, as it more accurately mirrors our production configurations in IIS7. However, when I go through following process, the libraries used by IIS Express don't seem to be updating.
Run app, find bug
Stop VS2010, fix bug
Build/Run
Testing reveals the new code is not being used
IIS Express continues to run even after stopping the debugger in VS2010, so I'm assuming it's just holding onto the binaries that were used when it was initially launched. Is there a way to get it to use the updated binaries? Or is this the expected behavior? Right now, the only way I can get the new binaries used is to completely exit VS2010 and then reload the project/solution. Even selecting "stop" from the IISExpress systray icon doesn't seem to actually help (it doesn't appear to actually stop the process).
Obviously closing VS2010 and reloading the solution each time is a less-than-ideal workflow.
EDIT: The project is configured to run IIS Express from right click project -> Web. The project URL does not use any virtual directories, it is at root of the local host on port 60830. I thought I remembered seeing IIS Express in the F4 properties listing before, it's not listed there at all right now.
I am trying to put a breakpoint in the code of a View in a ASP.NET MVC 2 project but Visual Studio complains that:
"This is not a valid location for a breakpoint"
I have tried multiple ways to it (the "mouse way, F9, using the menu option). I am using Win2008 and running the site in IIS7.
Slandau's answer shows how to turn on compilation - a great start. Now, if only debugging would work!
If you use the Razor view engine, you can be easy to set the break point and it works.
In Visual Studio 2010, you can right-click an aspx page in a web forms app, or on the web forms app itself in the solution explorer, and you get "View in Browser" in your context menu.
In ASP.NET MVC projects, this item doesn't seem to be available in the context menu. The only way I know to run the app is to set the MVC app as a startup project and hit CTRL+F5. But, if there are two MVC apps in the solution, this doesn't really work. How do you accomplish this for mvc apps?
You really can't.
Routes are determined at runtime. There is no way for Visual Studio to know what View its going to use until routes are added, controller actions are hit and the ActionResult is executed.
You can configure your web applications to use IIS so you don't have to hit F5 to run them. The IIS process will automatically start the web site for you. It's such a time saver!
Right click a web project and choose Properties
Go to the Web tab and choose the "Use Local IIS Web server" option.
Enter a url like http://localhost/MyProject
Rebuild.
Navigate your browser to the url you entered.
If you want to debug your website, you can go to Debug > Attach to process..., then attach to w3wp.exe. This will attach to all web apps within your solution. (You might have to select the show processes from all uses option.) If you've just rebuild, you have to reload the site before IIS recycles and the breakpoints turn solid red. (If the breakpoints are ever only outlined in red that means the code running in IIS is an older build than what you are seeing. In rare cases you may have to kill the IIS process, but cleaning and rebuilding usually clears this up for me.)
Note: you'll probably have to go into Window's Programs and Features control panel and enable the IIS features. VS should prompt you if these aren't configured already.
I am doing an MVC project... am very new to MVC... something very strange is happening...
When I drop a control from the toolbox to the design page visual studio closes.. I have no clue why this happens.. am totally perplexed...I tried searching for possible solution in the net...nothing showed up...:(
Unless I've totally missed the boat, you shouldn't be able to drag-and-drop any control from the toolbox to an MVC view. At least in MVC 1.0, views and user controls do not implement code-behind by default, but, more importantly, the designer code file that gets modified in WinForms .ASPXs and .ASCXs is not created when the view is created. In MVC, controls are added to views using code-based HTML helpers or the actual HTML code. The fact that the default Visual Studio behavior when executing a drag-and-drop with a toolbox control is to modify the form's designer file could be causing the immediate exit, since the file doesn't exist.
P.S. Don't bother trying to create it...the framework isn't built to implement or support it and it would probably just slow you down, anyway.
Try to start Visual Studio in safemode via
cd C:\Program files\Microsoft Visual Studio 9.0\Common7\IDE
devenv.exe /safemode /log
If this works then one of the installed add ons is responsible for the crash. It often helps in my environment.
Also you may try cleaning up the project.
Run
c:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe yoursolution.sln /t:Clean
Might help if something got screwed in your project.