Solved

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

Posted on 2011-09-16
2
261 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
ID: 36553162
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
ID: 36951787
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

809 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