本文介绍了如何将MVC 4应用程序部署到基于Windows Web Server的专用主机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将MVC 4 Web应用程序部署到基于Windows Web Server 2008的专用主机.我正在使用SQL Server 2008 R2 Express作为我的后端数据库.关于以下内容,我需要采取什么步骤:

I want to deploy an MVC 4 web application to a Windows Web Server 2008 based dedicated hosting. I am using SQL Server 2008 R2 Express as my back-end database. What steps will I need to take regarding the following:

  1. 在Web服务器上安装SQL Server 2008 R2 Express并部署我的数据库.
  2. 使用SSMS远程管理SQL Express数据库.
  3. 在我的EF5生成的模型中配置数据库路径
  4. 部署我的应用程序
  5. 管理对我的应用程序的更改.

有人可以给我提供详细的答案/一些好的链接吗?

Can someone provide me a detailed answer/some good links?

推荐答案

这取决于您的提供者.大多数提供程序(如果不是全部)都允许您安装自己的许可的 SQL Server.如果您将使用Express版本,那么提供商应该也是应该允许的100%.您这里唯一需要的步骤是转到SQL Server的下载页面2008 R2 并下载所需的文件.该页面上需要的文件名中带有"ADV" 的文件.如果要安装64位操作系统,请选择 x64 ;如果要安装32位操作系统,请选择 x86 .

This depends on your provider. Most providers, if not all, allow you to install your own licensed SQL Server. If you will be using an Express edition then it is, and should be, 100% allowable by your provider. The only step you need here is to go to download page of SQL Server 2008 R2 and download the appropriate file you need. The files you need on that page are the ones with "ADV" in its name. Choose x64 if you will install a 64-bit OS or choose x86 if you will install a 32-bit OS.

这取决于您的提供商设置的防火墙.但是基本上,这是您将允许远程访问SQL Server的方式:

This depends on the firewall set by your provider. But basically this is how you will allow remote access to your SQL Server:

对于Windows 2008 R2

  1. 使用远程桌面登录到专用服务器.如果您不知道如何执行此操作,最好咨询您的提供商.
  2. 转到开始">所有程序">"Microsoft SQL Server 2008 R2">配置工具"-> SQL Server Configuration Manager
  3. 在步骤2中打开的窗口中,展开"SQL Server配置管理器(本地)"->"SQL Server网络配置"->"SQLExpress协议"
  4. 在右窗格中,右键单击"TCP/IP",然后选择属性".
  5. 选择"IP地址"标签,然后滚动到全部IP 部分.
  6. 将"TCP端口"值设置为1433或从1433更改为14333(或任何其他端口),然后单击确定".
  7. 再次右键单击TCP/IP,然后Enable
  8. 通过转到开始"->所有程序"->管理工具"->服务"->"SQL Server(SQLEXPRESS)"->重新启动"来重新启动SQL Server. Restart在左窗格中.
  1. Login to your dedicated server using Remote Desktop. If you don't know how to do this, it's best that you consult with your provider.
  2. Go to Start > All Programs > Microsoft SQL Server 2008 R2 > Configuration Tools -> SQL Server Configuration Manager
  3. On the window that open in step #2, expand SQL Server Configuration Manager (Local) -> SQL Server Network Configuration -> Protocols for SQLExpress
  4. On the right pane, right-click TCP/IP and select Properties.
  5. Select the IP Addresses tab and then scroll to the IP All section.
  6. Set/change the TCP Port value to/from 1433 to 14333 (or any other port) and then click OK.
  7. Right-click TCP/IP again and Enable it
  8. Restart your SQL Server by going to Start -> All Programs -> Administrative Tools -> Services -> SQL Server (SQLEXPRESS) -> Restart. The Restart is on the left pane.

不幸的是,我无法回答这一问题,因为我相信您正在使用EF设计器来创建模型.我从未以这种方式使用过EF,而只是通过代码优先.我必须跳过这一部分,然后让您使用Google.

Unfortunately, I cannot answer this one as I believe you are using the EF designer in creating your model. I never worked with EF that way, but only by code-first. I have to skip this part and let you Google this.

已经有这里写的很好的文档,所以在这里我不会重复.基本上,您需要做的是在专用服务器上启用FTP.然后,一旦设置完成,就可以继续 bin-deploying 您的应用程序.

There is already a good documentation written here so I will not dupliate it here. Basically what you need to do is enable FTP on your dedicated server. Then once that is setup you can go on with bin-deploying your application.

我假设您在这里要问的是,如果您对应用程序进行了更改,您将如何重新部署它. bin-deployment 不会造成伤害.仅部署有更改的文件是一个好方法.了解哪些文件已更改取决于您使用的工具.此外,如果您没有任何精美的设置可以告诉用户您正在将更改部署到站点,则可能需要看看这篇文章.它告诉您将App_Offline.htm文件放在根Web目录中.毕竟MVC仍然是ASP.Net,这仍然适用于MVC.

I assume what you are asking here is that if you have changes to your application, how would you re-deploy it. A bin-deployment will not hurt. Deploying only the files in which you have changes is a good approach. Knowing which files changed can vary depending on the tools you use. In addition, if you don't have any fancy setup that will tell your users you are deploying changes to your site, you might want to take a look at this post. It tells you to put a App_Offline.htm file in your root web directory. That should still work with MVC, after all MVC is still ASP.Net.

这篇关于如何将MVC 4应用程序部署到基于Windows Web Server的专用主机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 01:41