Solved

Page not found occurs unless recompile during debugging using MS VS2010 MVC3 Razor

Posted on 2011-09-16
2
260 Views
Last Modified: 2012-05-12
My first MVC3 razor app.  Running into something I think might be eazy to solve, given my ignorance.  Clicking "run" arrow to debug opens web page with my app.  If I close the browser and click again, I may or may not get "page not found."  Drove me crazy as I was changing code to attempt to fix the problem. Then, I discovered that the only fix I need was to edit any .cs file, type a space, rebuild and then run.  So, now for each edit, to avoid the suprious "page not found" , regardless of what file I am editing, say .js or .cshtml, I bring up a .cs, type my space and rebuild just to avoid the "page not found" error.  This doesn't seem like the intended behavior.

Similarly, if I am just editing a .js file and making a change, if I simply hit "run" to start debugging, the changed code is not necessarily loaded. The old version has been cached and continues to be chosen over the newly edited file when "run" debugging.  Found a workaround to use "CCleaner" app to clear out browser cache. But this also is laborious and doesn't seem like reasonable behaviour, compared to regular VS2008 asp.net debugging.

Settings ? Config ? Attributes ?

Thanks!
0
Comment
Question by:azTop
2 Comments
 
LVL 3

Accepted Solution

by:
nixkuroi earned 400 total points
Comment Utility
If you go into your project properties, it's probably set to use your "current page" as the default page.  If you set it to a specific URL, it will stop doing that.  The problem is that it's trying to guess which page you want to see based on the file you're currently editing and only goes to the default page when you're not editing a view or a viewmodel.

Try changing the default start page behavior in the project properties and this should put you right.
0
 

Author Closing Comment

by:azTop
Comment Utility
Selected "Specific Page" and put in the controller name ( minus the word "Controller" ).

Can't use  "..." button as it is going to put in a whole path and file extension ( cshtml ) which is of course not MVC-ish.

Thanks a mil. Shortened my debugging cycle by 10+ seconds!
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Read about why website design really matters in today's demanding market.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now