Skip to main content
 首页 » 编程设计

python之Windows Server 2008/IIS 7 上 Mercurial 1.9.2 的 HTTPS 给我 Errno 10054

2025年05月04日8hnrainll

我们是一家小公司(它是一家微软商店),我们目前正在使用安装了 VisualSVN 的 subversion(顺便说一句,很容易设置) 由于 svn 中的分支噩梦,我目前正在评估 Mercurial。

所以首先我跟着 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 = 

网络配置

 <?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 项目并且成功了!...这真令人沮丧

我错过了什么吗?任何帮助将不胜感激。

请您参考如下方法:

在 https://www.mercurial-scm.org/wiki/CACertificates 中描述了使用 Mercurial 设置证书

在这个页面上有一条注释说“使用 openssl,而不是 IIS,来生成证书”- 显然 IIS7 自签名证书在 Mercurial 使用的 SSL 库中无法验证。

如果您安装了 TortoiseHg,您的 Mercurial 证书将从 hgrc.d/cacert.pm 读取。这意味着您必须在此处添加您的自签名证书。

否则,获得安装故障排除帮助的最有效方法是通过 Mercurial IRC