我是否需要在 Web 服务器上安装 MVC 3/4 才能运行 mvc 应用程序 [英] Do I need to install MVC 3/4 on web server to run mvc application

查看:24
本文介绍了我是否需要在 Web 服务器上安装 MVC 3/4 才能运行 mvc 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 MVC 4 应用程序并且在我的 DEV 机器上运行良好,我在其中安装了 VS 2010 的 MVC 4 扩展.

在使用 IIS 7 部署到 Web 服务器时,我是否需要安装 MVC 4 或者我的项目中包含的 dll 是否足够?

我问的原因是我们需要向基础架构团队提供需求.

谢谢.

解决方案

您无需在服务器上安装 MVC 即可运行 MVC 应用程序.Visual Studio 中有一种叫做可部署依赖的东西.这将在您发布时将您的 MVC DLL 发布到您的 bin 文件夹中.

来自

您应该拥有 Visual Studio 2010 SP1.否则,当您右键单击要发布的项目时,它不会显示在上下文菜单中.

从 MVC4 开始,运行 MVC 应用程序所需的所有程序集都会自动添加到 bin 目录中,并且任何 MVC4 应用程序都是 bin-deployable(意味着您可以在服务器中运行它而无需显式安装 MVC).出于这个原因,包含可部署程序集对话框已从 Visual Studio 2012 中删除

I've a MVC 4 application and runs well on my DEV Machine where I installed MVC 4 extension for VS 2010.

When deploying to the web server with IIS 7, do I need to install MVC 4 or should the dll included on my project is sufficient?

The reason I'm asking is we need to provide the requirement to infrastructure team.

Thanks.

解决方案

You can run an MVC application without installing MVC on your server. There is something called deployable dependency in Visual studio. That will publish your MVC DLLs in your bin folder when you publish it.

from the msdn page,

This will add assemblies (DLL files) to a Web site project or Web application project. When you deploy your Web site or application, the files are included in the deployed project. This is useful if applications or technologies that your project depends on are not already installed on the server that will host your Web project. For example, you can use this feature to deploy an ASP.NET MVC 3 Web application to a server that does not have ASP.NET MVC 3 installed.

Right Click on Project and Select Add Deployable Dependency from the context menu

Select what all DLLs you want to be published

After clicking OK, You will see a new folder called _bin_deployableAssemblies. You can do normal Publishing procedure now and you will have the dlls in the bin folder of the publish output.

Check this post for more details http://haacked.com/archive/2011/05/25/bin-deploying-asp-net-mvc-3.aspx

You should have Visual Studio 2010 SP1. Otherwise it will not be shown in the context menu when you right click on the project to be published.

EDIT : As of MVC4, all necessary assemblies to run an MVC application are automatically added to the bin directory, and any MVC4 application is bin-deployable (means you can run it in a server without explicitly installing MVC) . For this reason, the Include Deployable Assemblies dialog has been removed from Visual Studio 2012

这篇关于我是否需要在 Web 服务器上安装 MVC 3/4 才能运行 mvc 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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