This question already has an answer here:
Debug current page in ASP.NET MVC
(1 answer)
Closed 4 years ago.
I'm an absolute beginner at asp.net mvc, i am not sure what changes i made to the project but now upon debugging the project in visual studio 2013, it starts at the path
localhost:port/views/controller/action
instead of
localhost:port/controller/action
and thus giving me a 404 not found error. How do i go about resolving this and rectifying this path? Upon changing this manually to /controller/action the page loads properly but somewhy on debugging it always tries to access the wrong path.
You are starting your app while current open window in Visual Studio is your view page, try to switch to controller.
Related
I am building a project using ASP.NET MVC CORE. I want to be able to run my project and see the impact of my code changes in real time, i.e., I see the changes on the browser as I tweak things in Visual Studio 2022.
What extension do I need for this?
I realise this question has probably been asked before but I haven't been able to find the answer here or through Google.
I discovered the answer to this question this morning. I only need to hit F5 in the browser and the code changes will show.
This question already has answers here:
.NET Core MVC Page Not Refreshing After Changes
(15 answers)
Closed 11 months ago.
I was unhappy after moving to .NET 6 when I discovered that changes I made to the razor weren't being automatically compiled after clicking save. I spent months having to restart the whole web server every time I made a small change to the site I'm developing. I scoured the internet looking for a solution and even communicated with a Microsoft team member, all to no avail.
Luckily, my coworker stumbled into a solution that works perfectly and I wanted to share it with other people who are having the same issue.
Just add this library to the project file and it'll start working.
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.1" />
This question already has answers here:
Why does page not update after refresh when .cshtml changes
(6 answers)
Closed 2 years ago.
I have recently upgraded my ASP.NET MVC Core 2.2 application to Core 3.1, everything works well, but in debug sessions if I make any changes to CSHTML file, like adding a new HTML tag or change code in JS file, it doesn't reflect by refreshing the app on localhost debug session. I will have to stop my VS and re-build and run in debug mode.
This is happening only for ASP.NET Core 3.1 in other projects I have
with ASP.NET Core 2.2 for any CSHTML changes I don't have to rebuild
the solution.
I am using Microsoft Visual Studio Enterprise 2019 Version 16.4.1
Any help is greatly appreciated.
Found answer on SO: .NET Core 3.0 - Preview 2 - Razor views don't automatically recompile on change
Install NuGetpackage Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
update startup.cs with
services.AddControllersWithViews(x=>x.SuppressAsyncSuffixInActionNames = false)
.AddRazorRuntimeCompilation();
I am mvc 2 newbie. got this weird error message, couldn't figure out how to fix it.
I am using visual studio 2010 and my project is asp.net mvc 2 using .net 4.0
I right clicked inside the action method to generate the view. It kept giving me error message. I dont have that problem before, only happened in this project.
If it happens on everything, try reinstalling Visual Studio.
If it's a problem only with MVC Framework, try dwonloading it from here http://www.asp.net/mvc and install again. FileNotFoundException in the VS directory indicates that probably some required files are missing.
I assume Tut.Domain is something you have built? If so, you either are not building it, or it is not located in the correct location for the application to pick up. If you read the end of the error message, prior to stack trace, it mentions Tut.Domain, which is where your troubleshooting should begin.
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.