VS2010 ASP.NET部署
如何部署到共享托管环境...代码和数据库(完整的 SQL)。
将 50MB 单个项目 ASP.NET Web 应用程序项目和数据库获取到可访问 FTP 和 SQL Management Studio 端口的实时服务器时,您最喜欢的方法是什么?
经过一天的探索矿井是: - 使用 Web.Debug.config 轻松允许不同的连接字符串、smtp 等
在项目的属性中设置打包/发布 SQL 以获得源数据库信息。
更改 .csproj 以允许 DROP 语句 ScriptDropsFirst="True" 来自 http://vishaljoshi.blogspot.com/2009/08/replacing-your-old-db-with-new-one.html
部署到文件系统 c:\deploy 并使用 FileZilla复制到我的 FTP 站点(仅当源较新时才覆盖)
使用 SQL 管理Studio 从 \obj\Release\AutoScripts 获取 .SQL 脚本 替代文本 http://www.programgood.net/vsscreen.jpg
How do I deploy to a shared hosting environment... code and database (full blown SQL).
What is your favorite way to get a 50MB single project ASP.NET Web Application Project and database to a live server with FTP and SQL Management Studio ports accessible?
After a day of exploration mine is:
- Use the Web.Debug.config to easily allow the different connection strings, smtp etc
setup Package/Publish SQL in properties of the Project to have source database information.
change the .csproj to allow DROP statements ScriptDropsFirst="True" from http://vishaljoshi.blogspot.com/2009/08/replacing-your-old-db-with-new-one.html
deploy to a filesystem c:\deploy and use FileZilla to copy to my FTP site (with overwrite only if source is newer)
Use SQL Management Studio to take the .SQL script from \obj\Release\AutoScripts
alt text http://www.programgood.net/vsscreen.jpg
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只要您不介意这可能导致的短暂停机,FileZilla 部署就可以。在部署时,站点可能处于不一致的状态(例如,您部署了一个 .aspx 文件,该文件引用了尚不存在的 DLL 中的代码隐藏)。因此,在此期间访问该网站的访问者可能会遇到错误 - 如果您没有发现这些错误,他们将看到“死亡黄屏”。一旦部署了所有文件,这个问题就会消失。
这是一个过去对我有用的过程,用于将停机时间最短地部署到单个服务器:
如果您还要更改数据库架构,则需要与 (4) 同时进行。或者,如果更改与旧版本的代码兼容,您可以更快地完成它们。
我一直假设你只有一台服务器。如果您有服务器场,则可以通过一次从负载平衡池中取出一台服务器来进行滚动部署。
FileZilla deployment is OK as long as you don't mind the brief downtime this may cause. While you're deploying, the site can be in an inconsistent state (e.g. you've deployed a .aspx file which references code-behind in a DLL that isn't there yet). So visitors to the site during this time can run into errors - if you don't catch these errors, they'll see the "yellow screen of death". This will clear up once all the files are deployed.
Here's a process that's worked for me in the past, for minimal-downtime deployment to a single server:
If you're also making DB schema changes, you'd want to do that at the same time as (4). Or if the changes are compatible with the old version of the code, you could do them sooner.
I've been assuming you only have the one server. If you have a server farm, you can do rolling deployments by taking one server at a time out of the load-balancing pool.