VS2010 ASP.NET部署

发布于 2024-09-13 10:26:38 字数 792 浏览 2 评论 0原文

如何部署到共享托管环境...代码和数据库(完整的 SQL)。

将 50MB 单个项目 ASP.NET Web 应用程序项目和数据库获取到可访问 FTP 和 SQL Management Studio 端口的实时服务器时,您最喜欢的方法是什么?

经过一天的探索矿井是: - 使用 Web.Debug.config 轻松允许不同的连接字符串、smtp 等

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乱世争霸 2024-09-20 10:26:38

只要您不介意这可能导致的短暂停机,FileZilla 部署就可以。在部署时,站点可能处于不一致的状态(例如,您部署了一个 .aspx 文件,该文件引用了尚不存在的 DLL 中的代码隐藏)。因此,在此期间访问该网站的访问者可能会遇到错误 - 如果您没有发现这些错误,他们将看到“死亡黄屏”。一旦部署了所有文件,这个问题就会消失。

这是一个过去对我有用的过程,用于将停机时间最短地部署到单个服务器:

  1. 在生产服务器上,将所有代码从实时位置(例如 c:\Sites\MySite)复制到备份位置(例如 c: \Sites\MySite_bak)
  2. 将站点的虚拟根目录从 c:\Sites\MySite 更改为 c:\Sites\MySite_bak。这会给站点访问者带来一些延迟,因为 ASP.NET 需要重新 JIT ASPX 页面;但访问者不会看到错误。
  3. 使用 FileZilla 部署到 c:\Sites\MySite,并“如果源较新则覆盖”
  4. 将站点的虚拟根目录从 c:\Sites\MySite_bak 更改回 c:\Sites\MySite。这将自动将该站点切换到新版本。还会有另一次 JIT 延迟。
  5. 将备份版本保留在实时服务器上,以防您需要恢复更改。

如果您还要更改数据库架构,则需要与 (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:

  1. On the production server, copy all code from the live location (e.g. c:\Sites\MySite) to a backup location (e.g. c:\Sites\MySite_bak)
  2. Change the site's virtual root from c:\Sites\MySite to c:\Sites\MySite_bak. This will cause some delays for site visitors, since ASP.NET needs to re-JIT the ASPX pages; but visitors won't see errors.
  3. Use FileZilla to deploy to c:\Sites\MySite, with "overwrite if source is newer"
  4. Change the site's virtual root from c:\Sites\MySite_bak back to c:\Sites\MySite. This will atomically switch the site to the new version. There'll be another JIT delay.
  5. Keep the backup version around on the live server in case you ever need to revert your changes.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文