如何将 Subversion 存储库发布到本地 IIS?
在工作中,我们有一台安装了 IIS 和 Subversion 的 Windows Server 2003。 我们用它在本地发布和测试 我们的 ASP.NET 网站。 每个程序员都在他的 PC 上安装了 Tortoise,并且可以更新/提交内容到服务器。 托管存储库工作正常。 但保存在这些存储库中的文件需要复制到我们的本地 IIS(虚拟目录)。
将这些 Subversion 存储库发布到本地 IIS 的简单方法是什么?
编辑:
感谢 puetzk 我添加了一个简单的 bat 文件,每次提交发生时都会执行该文件(检查 关于钩子的颠覆文档)。 我的bat文件只包含:
echo off
setlocal
:: Localize the working copy where IIS points)
pushd E:\wwwroot\yourapp\trunk
:: Update your working copy
svn update
endlocal
exit
At work, we have a windows server 2003 with IIS and Subversion installed. We use it to publish and test locally
our ASP.NET websites. Every programmer has Tortoise installed on his PC and can update/commit content to the server. Hosting the repositories is working fine.
But the files kept in those repositories needs then to be copied to our local IIS (virtual directories).
What is an easy way to publish those subversion repositories to our local IIS?
Edit:
Thanks to puetzk I added a simple bat file that gets executed every time a commit occurs (check the subversion documentation about hooks). My bat file only contains:
echo off
setlocal
:: Localize the working copy where IIS points)
pushd E:\wwwroot\yourapp\trunk
:: Update your working copy
svn update
endlocal
exit
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
只需将 Web 服务器的文件区域保留为工作副本,并在您想要“发布”时在其中执行 svn up 即可。 如果您觉得 .svn 文件夹的内容看起来不整洁,请将其配置为隐藏它们(我不具体知道如何执行此操作,但我认为可以完成)。 他们已经有文件系统隐藏位,这可能会解决这个问题。
如果您希望它真正自动(有人提交后立即更新),请在 SVN 服务器上使用提交后挂钩脚本来启动第一个进程。
评论中的其他人建议使用导出而不是结账。 这也可以工作,并避免 .svn 混乱,但有两个缺点。 第一,它每次都必须重新下载整个内容,而不仅仅是修改后的文件(因为它没有保留 .svn 目录来记住它有什么)。 如果你有很多文件,这会慢得多。 第二,更新自动替换文件(将新版本写入 .svn/tmp,然后将其移动到位)。 导出会在下载时将文件逐渐写入目标位置。 这意味着导出可能会将不完整的文件传递给在错误时间浏览该文件的人。
Just keep the web server's file area as a working copy, and perform an svn up in it whenever you want to "publish". Configure it to hide the contents of the .svn folders if they seem untidy to you (I don't specifically know how to do this, but I assume it can be done). They will already have the filesystem hidden bit, which may take care of this.
If you want it really automatic (updates as soon as someone commits), use a post-commit hook script on the SVN server to kick off the first process.
Others in the comments have suggested using export instead of checkout. That can work too, and avoids the .svn clutter, but has two drawbacks. One, it has to redownload the entire contents every time, not just the modified files (since it didn't keep the .svn dir to remember what it has). If you have a lot of files, this will be much slower. Two, update replaces the file atomically (writes the new version in .svn/tmp, then moves it into place). Export writes the file gradually into it's destination as it downloads. That means export could deliver an incomplete file to someone who browsed it at just the wrong time.
SVN不支持IIS; 但是,您可以将独立的 svnserve 服务器作为 Windows 服务运行。
有关于它的 SVN 常见问题解答条目,以及关于 < href="http://blogs.vertigosoftware.com/teamsystem/archive/2006/01/16/Setting_up_a_Subversion_Server_under_Windows.aspx" rel="nofollow noreferrer">Vertigo Software 博客也可能有帮助。
更新:
经过您的澄清,我发现您正在寻找的是一种在签入后自动更新服务器上的代码的方法。查看 CruiseControl.NET,查看 subversion 集成教程 看起来它应该做你想要的。
更新 2:本教程介绍 集成 Subversion、CruiseControl.NET 和 Nant。
SVN doesn't support IIS; you can however run the standalone svnserve server as a windows service.
There's the SVN FAQ entry about it, and this blog post on Vertigo Software blog may be helpful too.
UPDATE:
After your clarification, I see that what you are looking for is a way to automatically update the code on the server after it's checked in. Look into CruiseControl.NET, after looking at the subversion integration tutorial it looks like it should do what you want.
UPDATE 2: This tutorial describes integrating Subversion, CruiseControl.NET and Nant.
也许SVNIsapi可以解决这个问题(http://www.svnisapi.com)。 因为它只使用 IIS 安装,因此您不需要 APACHE 服务器或 SVNSERVER 服务。 其次,应该可以将 ASP.NET ISAPI 插件堆叠到 SVNISAPI 的处理上,以便从存储库读取后解释 ASP.NET (.aspx) 页面。
干杯
保罗
maybe SVNIsapi can solve the problem (http://www.svnisapi.com). Cause it only utilizes an IIS installation, therefore you don't need an APACHE server or an SVNSERVER service. Secondly it should be possible to stack the ASP.NET ISAPI plugin onto the processing of SVNISAPI, so that a ASP.NET (.aspx) page will interpreted after read from the repository.
Cheers
Paolo
使用者可以使用免费的Visual-SVN Server来快速安装带有Apache前端的Subversion。 它还有一个很好的 MMC 管理单元,用于管理服务器和存储库。
您将能够通过 HTTP 或 HTTPS 访问 Subversion,但端口号必须与本地 IIS 使用的端口号不同(Visual-SVN 服务器的默认端口为 8080)。
如果您确实需要使用本地 IIS 端口 80 访问存储库,您可以尝试 SVN-IIS ,它的作用作为 IIS 和 Apache 之间的桥梁。 不过我自己还没有尝试过这个。
Use can use the free Visual-SVN Server to quickly install Subversion with Apache front end. It also have a nice MMC snap-in for managing the server and repositories.
You will than be able to access subversion with HTTP or HTTPS, but the port number must be different from the one your local IIS uses (default port for Visual-SVN server is 8080).
If you really need to access the repositories using your local IIS port 80, you can try SVN-IIS which acts as a bridge between your IIS and Apache. I haven't tried this one myself though.