windows 如何将 subversion 存储库发布到本地 IIS?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/118205/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I publish a subversion repository to a local IIS?
提问by jdecuyper
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).
在工作中,我们有一个安装了 IIS 和 Subversion 的 Windows Server 2003。我们使用它在本地发布和测试我们的 ASP.NET 网站。每个程序员都在他的 PC 上安装了 Tortoise,并且可以将内容更新/提交到服务器。托管存储库工作正常。但是保存在这些存储库中的文件需要复制到我们的本地 IIS(虚拟目录)。
What is an easy way to publish those subversion repositories to our local IIS?
将这些 subversion 存储库发布到我们本地 IIS 的简单方法是什么?
Edit:
Thanks to puetzkI added a simple bat file that gets executed every time a commit occurs (check the subversion documentationabout hooks). My bat file only contains:
编辑:
感谢puetzk,我添加了一个简单的 bat 文件,每次发生提交时都会执行该文件(查看有关钩子的subversion 文档)。我的 bat 文件只包含:
echo off
setlocal
:: Localize the working copy where IIS points)
pushd E:\wwwroot\yourapp\trunk
:: Update your working copy
svn update
endlocal
exit
回答by puetzk
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.
只需将 Web 服务器的文件区域保留为工作副本,并在您想要“发布”时在其中执行 svn up。配置它以隐藏 .svn 文件夹的内容,如果它们对你来说看起来不整洁(我不知道如何做到这一点,但我认为可以做到)。他们已经有文件系统隐藏位,这可能会解决这个问题。
如果您希望它真正自动(在有人提交后立即更新),请在 SVN 服务器上使用提交后挂钩脚本来启动第一个进程。
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 混乱,但有两个缺点。一,它每次都必须重新下载整个内容,而不仅仅是修改后的文件(因为它没有保留 .svn 目录来记住它所拥有的内容)。如果你有很多文件,这会慢得多。二、更新自动替换文件(将新版本写入 .svn/tmp,然后将其移动到位)。导出将文件在下载时逐渐写入其目的地。这意味着导出可能会将不完整的文件传送给在错误时间浏览它的人。
回答by Aeon
SVN doesn't support IIS; you can however run the standalone svnserve server as a windows service.
SVN 不支持 IIS;但是,您可以将独立的 svnserve 服务器作为 Windows 服务运行。
There's the SVN FAQ entryabout it, and this blog post on Vertigo Software blogmay be helpful too.
有关于它的SVN 常见问题条目,Vertigo Software 博客上的这篇博文也可能有帮助。
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 tutorialit looks like it should do what you want.
更新:在您澄清之后,我看到您正在寻找的是一种在签入后自动更新服务器上代码的方法。查看CruiseControl.NET,在查看subversion 集成教程后,它看起来应该做什么你要。
UPDATE 2: This tutorial describes integrating Subversion, CruiseControl.NET and Nant.
更新 2:本教程描述了Subversion、CruiseControl.NET 和 Nant 的集成。
回答by user231161
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.
也许 SVNIsapi 可以解决这个问题(http://www.svnisapi.com)。因为它只使用 IIS 安装,因此您不需要 APACHE 服务器或 SVNSERVER 服务。其次,应该可以将 ASP.NET ISAPI 插件堆叠到 SVNISAPI 的处理上,以便在从存储库读取后解释 ASP.NET (.aspx) 页面。
Cheers Paolo
干杯保罗
回答by zvikara
Use can use the free Visual-SVN Serverto quickly install Subversion with Apache front end. It also have a nice MMC snap-in for managing the server and repositories.
使用可以使用免费的Visual-SVN Server快速安装带有Apache 前端的Subversion。它还有一个很好的 MMC 管理单元,用于管理服务器和存储库。
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).
您将能够使用 HTTP 或 HTTPS 访问 subversion,但端口号必须与本地 IIS 使用的端口号不同(Visual-SVN 服务器的默认端口为 8080)。
If you really need to access the repositories using your local IIS port 80, you can try SVN-IISwhich acts as a bridge between your IIS and Apache. I haven't tried this one myself though.
如果您确实需要使用本地 IIS 端口 80 访问存储库,您可以尝试SVN-IIS,它充当 IIS 和 Apache 之间的桥梁。不过我自己还没有尝试过这个。