In Visual Studio 2010, how do you call the View in Browser function in an MVC application?

In Visual Studio 2010, you can right-click the aspx page in the web form application or in the web form itself in the solution explorer, and you will get “View in browser” in your context menu.

In ASP.NET MVC projects, this item does not appear in the context menu. The only way I know to launch the application is to install the MVC application as launch and press CTRL + F5. But if the solution has two MVC applications, this does not work. How do you do this for mvc applications?

+6
asp.net-mvc visual-studio-2010
source share
2 answers

You really can't.

Routes are determined at runtime. Visual Studio does not know what it will look like until routes are added, controller actions are completed, and ActionResult is executed.

+5
source share

You can configure your web applications to use IIS so that you don't hit F5 to run them. The IIS process will automatically launch the website for you. This is such a time saver!

  • Right-click the web project and select Properties

  • Go to the Web tab and select Use Local IIS Web Server.

  • Enter a URL like http: // localhost / MyProject

  • Rebuild.

  • Go to your browser to the URL you entered.

If you want to debug your site, you can go to Debug> Attach to process ... and then attach to w3wp.exe. This will apply to all web applications in your solution. (You may need to select the show processes option from all of the use cases.) If you just rebuilt, you need to reload the site before IIS processes and the breakpoints turn solid red. (If breakpoints are ever only shown in red, this means that the code running in IIS is an older build than what you see. In rare cases, you may have to kill the IIS process, but cleaning up and adjustment usually clean this for me.)

Note: you may have to go to the Window program and function control panel and enable IIS functions. VS should tell you if they are not already configured.

+2
source share

All Articles