在浏览器中查看MVC 3 ASP.NET [英] View in Browser for MVC 3 ASP.NET

查看:109
本文介绍了在浏览器中查看MVC 3 ASP.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio 2010中,您可以右键单击Web表单应用程序中的aspx页面,或者右键单击解决方案资源管理器中的Web表单应用程序本身,然后您将获得在浏览器中查看。在您的上下文菜单中。



在ASP.NET MVC项目中,此项目似乎在上下文菜单中不可用。我知道运行应用程序的唯一方法是将MVC应用程序设置为启动项目并按CTRL + F5。但是,如果解决方案中有两个MVC应用程序,那么这并不是真的有用。你如何为mvc应用程序实现这个目标?



在我的场景中,有多个用户在不同的控制器/视图上处理应用程序,他们怎么能在不改变的情况下执行他们的视图Global.asax中的路线?

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?

In my scenario, There are multiple users working on application on different controllers/view, How could they execute their view without changes the routes in Global.asax ?

推荐答案

我在这里找到了一些东西



http://stackoverflow.com/questions/14003353/view-in-browser-for- mvc-3-asp-net [ ^ ]
I have found something here too

http://stackoverflow.com/questions/14003353/view-in-browser-for-mvc-3-asp-net[^]


完成第一个要求的最简单方法是添加一个普通的html文件。一旦你将一个html文件添加到你的MVC项目并右键单击它,你就会神奇地开始看到浏览在浏览器中查看选项!



来到你的下一个问题,你的意思是他们必须在不改变路线的情况下执行?他们只需要在浏览器或书签中输入相应的URL一次就不是吗?如果您从开发人员的角度谈论,他们每个人都可以设置一个特定页面,以便在每次开始调试时打开。为此,右键单击您的mvc项目,选择属性,然后选择 Web 选项卡,然后在右侧窗格,选择特定页面并输入网址 主页/索引



问题的第二部分并不清楚。请详细说明!
The most simplest way to accomplish your first requirement is to add a plain-old html file. Once you add a html file to your MVC project and right click on it, you will magically start seeing the Browse With and View In Browser options!

Coming to your next question, what do you mean by they have to execute without changing the routes? They just have to enter the appropriate url in the browser or bookmark once isn''t it ? In case you are talking from a developers perspective every one of them can set a specific page to open every time they start debugging. To do this, right click on your mvc project, choose Properties, then select the Web tab and then in the right pane, select Specific Page and enter the url say "Home/Index".

Your second part of the question isn''t clear. Do elaborate!


这篇关于在浏览器中查看MVC 3 ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆