代码之家  ›  专栏  ›  技术社区  ›  Artem Koshelev

使用IIS 6托管Mercurial

  •  15
  • Artem Koshelev  · 技术社区  · 15 年前

    我正在尝试在WindowsServer2003下建立由IIS托管的Mercurial存储库。跟随 this post 我安装了python 2.5.4.4和mercurial 1.3,设置了virtual dir,提取了library.zip并创建了hgwebdir.config。

    但是,当我试图打开 http://hostname/hg/hgwebdir.cgi 我得到一个错误_156;指定的CGI应用程序由于没有返回一组完整的HTTP头而表现错误。_我做得最好:

    1. 已检查到.py和.cgi扩展名的IIS映射。我甚至尝试使用fastcgi但没有成功。
    2. 在同一目录中创建了__Hello World__,并检查它是否正常工作。
    3. 已检查iusr、iwam和network service对python、IIS和repos目录的读取/执行权限。
    4. 尝试应用两个不同的修补程序 Mercurial mailing list . 既然他们都老了,我就没有成功过。
    5. 安装了sysinternals的procmon,并在请求期间检查了文件系统错误。在加载Python进程的库时,除了大量的缓冲区溢出之外,我什么也没有发现。
    6. 试图将“content-type:text/html”添加到脚本中。

    还有一件事是,当我请求不存在的脚本文件(例如/hg/inexist.cgi)时,我有相同的错误。没什么帮助!

    5 回复  |  直到 13 年前
        1
  •  5
  •   Jon Bright    14 年前

    我需要解决的更多问题:

    • 各种使用方法 c:\whatever\Python26\python.exe -u "%s" "%s" 代替使用 c:\whatever\Python26\python.exe -u -O -B "%s" "%s" -o使它还查找.py o文件(不只是.py或.pyc,至少在我的版本中不存在)。-B导致它不尝试编译找到的.py文件到.pyo文件(由于缺乏写权限而失败)
    • 我安装了python 2.7。Mercurial 1.6.2的.pyo文件是用python 2.6编译的。这导致了一个幻数错误。卸载2.7和安装2.6.5解决了这个问题。(如果您在将来某个时候读到了这一点,那么这一点可能不再相关了-根据您从哪里获取library.zip,检查mercurial目录或tortoisehg目录中的dll名称)
    • hgwebdir.cgi现在只是hgweb.cgi-webdir已集成到其中
        2
  •  1
  •   Artem Koshelev    14 年前

    最后,我得到了任何python脚本错误返回的“no headers”错误,所以我用控制台解释器检查了脚本,并修复了配置文件中的错误。当然,我应该在ServerFault上问这个问题,而不是StackOverflow——这项工作是因为睡眠不足:)

        3
  •  1
  •   BenAlabaster    14 年前

    有一个相当不错的职位 http://vampirebasic.blogspot.com/2009/06/running-mercurial-on-windows.html 这会让你开始,但是如果你需要更多的细节或者比作者做的更进一步,我有一篇由4部分组成的博客文章,涵盖了关于在IIS上启动和运行的所有信息,包括Active Directory集成、拉/推权限、用户界面自定义:

    http://www.endswithsaurus.com/2010/05/setting-up-and-configuring-mercurial-in.html

    值得一读…

        4
  •  1
  •   jjooeell    14 年前

    在我的情况下,这个错误是由行引起的 application = hgwebdir('c:\somewhere\hgweb.config') 在hgweb.cgi中,应该是 application = hgweb('c:\somewhere\hgweb.config') .

    此外,取消注释行 import cgitb; cgitb.enable() 在hgweb.cgi中,将提供有关错误(和其他错误)的更多信息。

    p.s.i在WindowsServer2003和IIS6.0上使用python 2.6.6和mercurial 1.7.3。

        5
  •  1
  •   BrotherOdin    13 年前

    在我的例子中,修复它的关键步骤是:c:\whatever\python26\python.exe-u-o-b“%s”“%s”

    在此之前,它不能处理错误:

    A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
    
     c:\hg\hgweb.cgi in ()
       13 import cgitb; cgitb.enable()
       14 
       15 from mercurial import demandimport; demandimport.enable()
       16 from mercurial.hgweb import hgweb, wsgicgi
       17 application = hgweb(config)
    mercurial undefined, demandimport undefined
    <type 'exceptions.ImportError'>: No module named mercurial 
          args = ('No module named mercurial',)