Windows Server 2008/IIS 7上Mercurial 1.9.2的HTTPS出现Errno 10054错误

2 投票
5 回答
1210 浏览
提问于 2025-04-17 03:39

我们是一家小公司(主要使用微软的产品),目前在用Subversion,并且安装了VisualSVN(其实设置起来挺简单的)。我现在在评估Mercurial,因为在Subversion中分支管理实在太麻烦了。

首先,我按照这个链接 http://www.firegarden.com/software/hosting-mercurial-repo-iis7-windows-server-2008r2-x64-python-isapi-cgi 使用了最新的Mercurial源代码1.9.2和Python 2.7,但遇到了下面的错误:

Failed to import callback module 'hgwebdir_wsgi'
The specified module could not be found.

所以我放弃了这个方法,然后我跟着这个链接 http://www.jeremyskinner.co.uk/mercurial-on-iis7/,这个方法有效,直到我到达启用SSL的步骤,这里出现了问题。我甚至使用OpenSSL设置了SSL证书 http://www.dylanbeattie.net/docs/openssl_iis_ssl_howto.html 但还是不行。这是我得到的错误:

URLError: [Errno 10054] An existing connection was forcibly closed by the remote host
[command returned code 255...]

服务器端我有这个 hgweb.config

[collections]
C:\repository\hg = C:/repository/hg

[web]
#push_ssl = false
allow_push = *
baseurl = /hg
cacerts =

web.config

 <?xml version="1.0" encoding="UTF-8"?>
 <configuration>
<system.webServer>
    <handlers>
        <add name="Python" path="*.cgi" verb="*" modules="CgiModule" scriptProcessor="C:\Python27\python.exe -u &quot;%s&quot;" resourceType="Unspecified" />
    </handlers>
    <rewrite>
        <rules>
            <rule name="rewrite to hgweb" patternSyntax="Wildcard">
                <match url="*" />
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                </conditions>
                <action type="Rewrite" url="hgweb.cgi/{R:1}" />
            </rule>
        </rules>
    </rewrite>
    <security>
         <requestFiltering>
           <requestLimits maxAllowedContentLength ="2147482624" />
        </requestFiltering>
    </security>
</system.webServer>
<system.web>
    <httpRuntime executionTimeout="540000" maxRequestLength="2097151"/>
</system.web>

客户端的hgrc

[paths]
default = https://webtest/hg/test/

[hostfingerprints]
webtest = 50:de:a4:d9:72:59:68:fd:91 ...

编辑 我试着在我的MacBook上安装MacHg进行测试。我使用了这个链接 http://machghelp.jasonfharris.com/kb/connections/how-do-i-add-a-server-certificate-or-fingerprint-for-https作为指导,结果成功了!这说明服务器没问题(也就是说,服务器可以通过http和https进行推送和拉取),所以我现在确定是我的Windows/TortoiseHg有问题。(但按照这些步骤在TortoiseHg上没有任何效果 :( )

编辑2 还有一个发现……我甚至无法通过https进行克隆,只能通过http工作。我尝试用https克隆一个CodePlex项目,结果成功了!这真的让我很沮丧。

我是不是漏掉了什么?任何帮助都将不胜感激。

5 个回答

0

确保你进入IIS的SSL设置,然后把客户端证书的选项设置为“忽略”。

1

在设置Mercurial的证书时,可以参考这个链接:https://www.mercurial-scm.org/wiki/CACertificates

页面上有个提示说“用openssl来生成证书,而不是用IIS”,这意思是IIS7生成的自签名证书在Mercurial使用的SSL库中无法通过验证。

如果你安装了TortoiseHg,你的Mercurial证书会从hgrc.d/cacert.pm这个文件中读取。这就意味着你需要在这里添加你的自签名证书。

如果你在安装过程中遇到问题,最有效的解决办法是通过Mercurial IRC来寻求帮助。

0

我用旧版本的Mercurial 1.8.4时,它能正常工作。所以我就不再继续调查这个问题了。

撰写回答