HTTPS for Mercurial 1.9.2 on windows server 2008/IIS 7 giving me Errno 10054
Question: We are a small company (its a Microsoft shop) we are currently using
subversion with VisualSVN installed (pretty easy to setup btw) I am currently
evaluating Mercurial because of branching nightmare in svn.

So first i followed <http://www.firegarden.com/software/hosting-mercurial-
repo-iis7-windows-server-2008r2-x64-python-isapi-cgi> with latest mercurial
source code 1.9.2 and python 2.7 got the below error

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

so i **scratched** that and then i followed this
<http://www.jeremyskinner.co.uk/mercurial-on-iis7/> and it worked until i
reached the step **Enabling SSL** which is where the problem is. i even setup
ssl certs using OpenSSL
<http://www.dylanbeattie.net/docs/openssl_iis_ssl_howto.html> still nothing.
this is the error i get

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

Server side i have this 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>
    

client side hgrc

    
    
    [paths]
    default = https://webtest/hg/test/
    
    [hostfingerprints]
    webtest = 50:de:a4:d9:72:59:68:fd:91 ...
    

**EDIT** I tried to install MacHg on my macbook to test. i used
<http://machghelp.jasonfharris.com/kb/connections/how-do-i-add-a-server-
certificate-or-fingerprint-for-https> as walkthrough and it WORKS!! so this
eliminates server(i.e.server can push & pull from both http & https) so now i
am sure its my windows/TortoiseHg which has problem. (but following these
steps for tortoiseHg gives me nothing :( )

**EDIT2** One more finding... i can't even clone using https, it only works
for http. I tried to clone one of codeplex projects using https and that
works!...This is really frustrating

Am i missing something? any help will be appreciated.


Answer: Setting up certificates with Mercurial is described in
<http://mercurial.selenic.com/wiki/CACertificates>

On this page there is that note that says "use openssl, not IIS, to generate
certificates" - apparently an IIS7 self-signed certificates does not validate
in the SSL library used by Mercurial.

If you install TortoiseHg, your Mercurial certificates will be read from
hgrc.d/cacert.pm. This means you must add your self-signed certificate here.

Otherwise, the most efficient way to get help troubleshooting your
installation is via [Mercurial IRC](http://mercurial.selenic.com/wiki/IRC)

