如何使用数据库部署asp.net mvc 4应用程序?

时间:2022-09-05 04:12:52

I'm new to asp.net and want to do the following:

我是asp.net的新手,想要做以下事情:

I have an asp.net mvc 4 website that uses a local database (mdf). I want to install that website on a windows 2012 server (amazon ec2).

我有一个使用本地数据库(mdf)的asp.net mvc 4网站。我想在Windows 2012服务器(amazon ec2)上安装该网站。

My Questions:

我的问题:

  • How do I handle the database?
  • 我该如何处理数据库?
  • How do I move it onto the server?
  • 如何将其移动到服务器上?

1 个解决方案

#1


1  

There are several steps:

有几个步骤:

  • According to Microsoft (http://msdn.microsoft.com/en-us/library/dd410407(v=vs.90).aspx), you should publish first your website to a local folder; you can embark your database by clicking Include files from the App_Data folder.
  • 根据Microsoft(http://msdn.microsoft.com/en-us/library/dd410407(v=vs.90).aspx),您应首先将您的网站发布到本地文件夹;您可以通过单击包含App_Data文件夹中的文件来启动数据库。
  • You will transfer your published folder to your Windows 2012 in, for example, a subfolder of c:\inetpub\wwwroot.
  • 您将已发布的文件夹转移到Windows 2012,例如,c:\ inetpub \ wwwroot的子文件夹。
  • You will have to create a new Web Site in IIS (I'll let you search by yourself ;-) )
  • 你将不得不在IIS中创建一个新的网站(我会让你自己搜索;-))

Note: I am not that familiar with mdf files, but you will certainly have to modify your web.config, to point to the actuel path of the mdf file (c:\inetpub\wwwroot\MY_SITE\AppData\MYDATABASE.mdf).

注意:我不熟悉mdf文件,但您必须修改web.config,指向mdf文件的实际路径(c:\ inetpub \ wwwroot \ MY_SITE \ AppData \ MYDATABASE.mdf)。

Note: Also, the IIS User account should have the right to write the database; so the folder c:\inetpub\wwwroot\MY_SITE\AppData\ should have its security modified accordingly (right click, Properties / Security) to add the IIS User (as this is the account that should run the Web Site).

注意:此外,IIS用户帐户应该有权编写数据库;因此文件夹c:\ inetpub \ wwwroot \ MY_SITE \ AppData \应相应地修改其安全性(右键单击,属性/安全性)以添加IIS用户(因为这是应该运行该网站的帐户)。

#1


1  

There are several steps:

有几个步骤:

  • According to Microsoft (http://msdn.microsoft.com/en-us/library/dd410407(v=vs.90).aspx), you should publish first your website to a local folder; you can embark your database by clicking Include files from the App_Data folder.
  • 根据Microsoft(http://msdn.microsoft.com/en-us/library/dd410407(v=vs.90).aspx),您应首先将您的网站发布到本地文件夹;您可以通过单击包含App_Data文件夹中的文件来启动数据库。
  • You will transfer your published folder to your Windows 2012 in, for example, a subfolder of c:\inetpub\wwwroot.
  • 您将已发布的文件夹转移到Windows 2012,例如,c:\ inetpub \ wwwroot的子文件夹。
  • You will have to create a new Web Site in IIS (I'll let you search by yourself ;-) )
  • 你将不得不在IIS中创建一个新的网站(我会让你自己搜索;-))

Note: I am not that familiar with mdf files, but you will certainly have to modify your web.config, to point to the actuel path of the mdf file (c:\inetpub\wwwroot\MY_SITE\AppData\MYDATABASE.mdf).

注意:我不熟悉mdf文件,但您必须修改web.config,指向mdf文件的实际路径(c:\ inetpub \ wwwroot \ MY_SITE \ AppData \ MYDATABASE.mdf)。

Note: Also, the IIS User account should have the right to write the database; so the folder c:\inetpub\wwwroot\MY_SITE\AppData\ should have its security modified accordingly (right click, Properties / Security) to add the IIS User (as this is the account that should run the Web Site).

注意:此外,IIS用户帐户应该有权编写数据库;因此文件夹c:\ inetpub \ wwwroot \ MY_SITE \ AppData \应相应地修改其安全性(右键单击,属性/安全性)以添加IIS用户(因为这是应该运行该网站的帐户)。