几周以来,我在使用 Subversion 时遇到了一些问题。当我尝试从 Visual Studio 2017 项目提交文件时,有些文件无法提交到我的 Visual SVN 服务器。准确地说,项目文件夹中的所有文件,如 *.cs、*.config、*.csproj、*.resx、...
我的设置:
客户端:Windows 10 上的 TortoiseSVN 1.9.7
服务器:Windows Server 2012r2 上运行的 IIS-ReverseProxy 后面的 VisualSVN
当我尝试提交例如 *.cs 文件时出现的错误:
Commit
D:\Test\branches\ScaraControl\ScaraControl\Form1.cs
D:\Test\branches\ScaraControl\ScaraControl\Form1.cs
Commit failed (details follow):
File 'D:\Test\branches\ScaraControl\ScaraControl\Form1.cs' is out of date
'/svn/Test/!svn/txr/5-9/branches/ScaraControl/ScaraControl/Form1.cs' path not found
You have to update your working copy first.
更新工作副本已成功完成,但未解决问题。
您可以在下图中看到我的项目。为了进行测试,我创建了一个全新的空存储库。正如您所看到的,.vs、bin 和 obj 文件夹及其内部的所有文件都将被忽略,所有其他文件夹都将提交到服务器(不包含其中的文件)。在第二张图片中,您可以看到我可以提交 *.sln 文件,但项目文件夹中没有其他文件。
为了进行测试,我创建了一个空文本文件并将其重命名为 text.cs。即使这个空文件也无法提交到服务器,并出现相同的错误消息。
由于所有客户端都会发生这种情况,我猜这更有可能是服务器端的问题,但我不知道是什么可能导致此错误。不幸的是,VisualSVN 服务器没有错误日志记录,或者至少没有我正在使用的免费版本。
如果我能得到任何解决这个恼人问题的提示,我将非常感激。
Edit1:问题是由 IIS 反向代理引起的
通过端口 8443 直接连接到 VisualSVN 服务器(绕过反向代理)后,一切都恢复正常。所以肯定是URL Rewrite模块的配置有问题。老实说,我花了很长时间才让它正常工作,因为我对所有设置的了解非常有限。
这是我的 Web.config,其中包含 URL 重写模块的设置。也许有些东西没有按应有的方式配置。如果您需要更多信息,请询问。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<outboundRules>
<rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1" enabled="true">
<match filterByTags="A, Form, Img" pattern="^http(s)?://svn.example.org:8443/(.*)" />
<action type="Rewrite" value="http{R:1}://svn.example.org/{R:2}" />
</rule>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
<rules>
<rule name="ReverseProxyInboundRule1" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{CACHE_URL}" pattern="^(https?)://" />
</conditions>
<action type="Rewrite" url="{C:1}://svn.example.org:8443/{R:1}" />
</rule>
</rules>
</rewrite>
<security>
<authorization>
<remove users="*" roles="" verbs="" />
<add accessType="Allow" users="" roles="Users" />
<add accessType="Allow" users="*" />
<add accessType="Allow" users="?" />
</authorization>
</security>
<urlCompression doStaticCompression="false" doDynamicCompression="false" />
<httpRedirect enabled="false" destination="https://svn.example.org" exactDestination="true" childOnly="true" />
<directoryBrowse enabled="false" />
</system.webServer>
</configuration>