简体   繁体   English

如何部署ASP.NET MVC3应用程序?

[英]How do I deploy an ASP.NET MVC3 Application?

I have created a web application using ASP.NET MVC3 in Visual studio (no SQL Server). 我已经在Visual Studio(无SQL Server)中使用ASP.NET MVC3创建了一个Web应用程序。 Now I want to deploy it and am looking for suggestions for the easiest possible way. 现在,我要部署它,并正在寻找最简单的建议。

As of Now what i did is(rule 1-10) http://msdn.microsoft.com/en-us/library/dd410407(v=vs.90).aspx 截至目前,我所做的是(规则1-10) http://msdn.microsoft.com/zh-cn/library/dd410407 (v=vs.90) .aspx

1- bin folder in project's folder 1-项目文件夹中的bin文件夹
2- Content folder 2-内容文件夹
3- Scripts folder 3-脚本文件夹
4- Views folder 4-视图文件夹
5- Global.asax 5- Global.asax
6- Web.config 6-Web.config
7- copy from C:\\Program Files\\Microsoft ASP.NET\\ASP.NET Web Pages\\v1.0\\Assemblies directory 7-从C:\\ Program Files \\ Microsoft ASP.NET \\ ASP.NET Web Pages \\ v1.0 \\ Assemblies目录复制
You should copy these files in "bin" directory before deploy website 部署网站之前,应将这些文件复制到“ bin”目录中

Microsoft.CSharp.dll - reference  
Microsoft.Web.Infrastructure.dll and .xml - copy  
System.Web.Helpers.dll and .xml - reference  
System.Web.Razor.dll and .xml - copy  
System.Web.Routing.dll - reference  
System.Web.WebPages.Deployment.dll and .xml - copy  
System.Web.WebPages.dll - reference  
System.Web.WebPages.Razor.dll and .xml - copy    

When you run application in Visual Studio 2010 with .net framework 4 and MVC 3 installed on your machine the following folders are automatically created: 当您在计算机上安装了.net Framework 4和MVC 3的情况下在Visual Studio 2010中运行应用程序时,将自动创建以下文件夹:

C:\\Program Files\\Microsoft ASP.NET\\ASP.NET MVC 3 C:\\ Program Files \\ Microsoft ASP.NET \\ ASP.NET MVC 3

C:\\Program Files (x86)\\Microsoft ASP.NET\\ASP.NET Web Pages. C:\\ Program Files(x86)\\ Microsoft ASP.NET \\ ASP.NET网页。

These folders also contain an “Assemblies” folder. 这些文件夹还包含一个“程序集”文件夹。

ASP.NET MVC references following additional assemblies: ASP.NET MVC引用以下附加程序集:

System.Web.Mvc
Microsoft.Web.Infrastructure
System.Web.Razor
System.Web.WebPages
System.Web.WebPages.Razor

To deploy your application on shared server with no support from your hosting company you can simply copy these DLL files and paste them to your BIN folder. 要在托管公司不提供支持的情况下将应用程序部署在共享服务器上,只需复制这些DLL文件并将其粘贴到BIN文件夹中即可。

Make DLLs local while publishing: 发布时将DLL设为本地:

If you don't want to copy these files manually or don't have permissions to copy and paste these files you can use this method. 如果您不想手动复制这些文件或没有复制和粘贴这些文件的权限,则可以使用此方法。

The DLL files mentioned in the manual method can be included in the Bin folder when you publish your project to a production. 当您将项目发布到生产环境时,手动方法中提到的DLL文件可以包含在Bin文件夹中。

To include them to the Bin folder, go to your MVC application project and expand the 'References' node in project tree. 要将它们包括在Bin文件夹中,请转到您的MVC应用程序项目,然后在项目树中展开“参考”节点。 Select above assemblies then right click and select 'Properties' and change 'Local Copy' to True as it is False by default. 选择以上程序集,然后右键单击并选择“属性”,并将“本地副本”更改为True,因为默认情况下为False。 If Local Copy attribute is set to TRUE then selected DLL will be included in 'Bin' folder when you publish your project. 如果本地复制属性设置为TRUE,则发布项目时,选定的DLL将包含在“ Bin”文件夹中。

In addition to all these answers about copying the mvc dll's manually. 除了有关手动复制mvc dll的所有这些答案之外。 Visual Studio 2010 (with SP1) has the abiltity to do this for you. Visual Studio 2010(带有SP1)可以为您执行此操作。

  1. Rightclick your mvc web project 右键单击您的MVC Web项目
  2. Click on Add Deployable dependencies 单击添加可部署依赖项
  3. Choose one or more of the three options (asp.net mvc, asp.net webpages with razor syntax, sql server compact) 选择三个选项中的一个或多个(asp.net mvc,带有razor语法的asp.net网页,SQL Server Compact)
  4. Publish your application. 发布您的应用程序。

Visual studio will now auto deploy the correct references in your bin folder. 现在,Visual Studio将自动在bin文件夹中部署正确的引用。

右键单击该项目,然后选择“发布”。

very easy steps- 非常简单的步骤-

  1. Put your application in C:\\inetpub\\wwwroot (for that first configure IIS on your system). 将您的应用程序放在C:\\inetpub\\wwwroot (为此首先在系统上配置IIS)。
  2. Now,click on windows, and write run. 现在,单击Windows,然后编写运行。
  3. A Textbox will appear, write 'inetmgr' inside it and click OK. 将出现一个文本框,在其中输入“ inetmgr”,然后单击“确定”。
  4. Expand 'Administrator' on left side of screen by clicking on its arrow. 单击屏幕左侧的箭头,展开“管理员”。
  5. Expand Sites and then Expand 'Default Web Site'. 展开站点,然后展开“默认网站”。
  6. Right click your application and choose 'Add to Web Application'. 右键单击您的应用程序,然后选择“添加到Web应用程序”。

That's it. 而已。 Icon next to your application will turn to a blue globe. 应用程序旁边的图标将变为蓝色地球。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM