如何使用 Azure 上的 MVC2 应用程序管理和发布数据库?
首先我要说的是,我对将应用程序部署到云的想法还很陌生,但我最近下载了 Azure SDK,并希望构建一个示例应用程序来让自己跟上进度。这就是我所做的。
- 下载 Azure SDK
- 创建新解决方案
- 添加新的 ASP.NET MVC2 Web 角色
- 编译
- 调试
当我在本地处于调试模式时,一切似乎都工作得很好 — 我可以创建用户、登录并单击。但是,当我部署解决方案时,我感觉数据库没有部署。我知道 SQL Azure 的工作方式与 SQL Express 不同,所以我有几个问题。
- ASP.NET MVC2 Web 角色及其随附数据库是否适合部署到 Azure?
- 如何将我的数据库“转移到云端”?
- 管理架构和查找数据以部署到 SQL Azure 的最佳方法是什么?
在寻找解决方案时,令我印象深刻的一件事是,Azure 没有大量优秀的文档——我发现的所有教程都是旧的或针对测试版的。帮助!
编辑:对我来说,理想的解决方案不需要每次部署时都打开 SQL Server Management Studio 导出架构/数据脚本。当然还有比这更好的方法吗?
I'll start by saying that I'm fairly new to the idea of deploying applications to the cloud, but I recently downloaded the Azure SDK and wanted to build a sample application to get myself up-to-speed. Here's what I did.
- Download the Azure SDK
- Create a new solution
- Add a new ASP.NET MVC2 Web Role
- Compile
- Debug
Everything seems to work just fine when I am in debug mode locally--I can create users, log in, and click around. When I deploy my solution, though, I feel like the database is not getting deployed. I understand that SQL Azure works differently from SQL Express, so I have a few questions.
- Is the ASP.NET MVC2 Web Role with its accompanying database meant for deployment to Azure?
- How can I get my database "into the cloud"?
- What is the best way to manage my schema and lookup data for deployment to SQL Azure?
One thing that struck me while I was searching for a solution is that there is not a wealth of good documentation for Azure--all of the tutorials I found are old or targeted at betas. Help!
Edit: The ideal solution to me does not involve opening SQL Server Management Studio to export my schema/data scripts every time I want to deploy. Surely there is a better way than this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
部署到 SQL Azure 与部署到运行 SQL Server 标准版或企业版的单独 SQL Server 计算机没有什么不同。这与部署到也运行 SQL Server Express 的 Web 服务器不同,后者允许您将 MDF 文件打包为 ASP.NET 应用程序的一部分,但这是设计使然。有可用的工具,但您也可以编写对数据库的更改的脚本(手动或自动)。
另一种可能的自动化部署方法是利用 SQL Azure 迁移向导,但这仍然需要一些操作设置(它更适合一次性迁移)。
Deploying to SQL Azure is no different than it would be when you are deploying to a separate SQL Server machine running SQL Server Standard or Enterprise edition. This is different from deploying to a web server that is also running SQL Server Express, that allows you to package an MDF file as part of the ASP.NET app, but that is by design. There are tools available, but you could also script the changes to the database (either by hand or automatically).
Another possible way of automating the deployment is by leveraging the SQL Azure migration wizard, but that will still require a bit of setting up (it is more geared towards 1-time-only migrations).
我强烈建议您在本地 SQL 服务器下进行开发,并通过 Red Gate 工具将更改部署到 Azure:SQL Compare 和 Data Compare v9 beta。在这方面他们是“最优秀的”。
另外,请关注这个免费工具:http://www.microsoft.com /en-us/sqlazure/datasync.aspx
它承诺在 SQL 数据库的本地版本和 Azure 版本之间进行数据同步。
希望这有帮助
I highly recommend you develop under local SQL server and deploy your changes to Azure via Red Gate tools: v9 beta of the SQL Compare and Data Compare. They are "most excellent" in this regard.
Also, keep an eye on this free tool: http://www.microsoft.com/en-us/sqlazure/datasync.aspx
It promises to do a data-sync between local and Azure versions of a SQL database.
Hope this helps
我最终做了一些更多的研究并与同事讨论。我们得出的结论是,没有像传统方式那样管理数据库的好方法,但您可以按照下面概述的流程进行操作。
这大概是目前最好的情况。您也可以使用数据层应用程序,它本质上做同样的事情。
I ended up doing some more research and discussing with coworkers. We came to the conclusion that there is no great way to manage databases as one traditionally would, but you can follow the process outlined below.
This is about the best it is going to be for now. You can alternatively use a Data Layer application, which essentially does the same thing.