简体   繁体   中英

Error while installing Mercurial on IIS7 64bit: “DLL Load Failed: %1 is not a valid Win32 application”

I'm installing Mercurial on an IIS7 webserver using this guide: http://pteradigm.com/2012/09/16/mercurial-on-iis-7-x86-or-x64/#hg_iis_python

I'm using the following versions:

  • python-2.7.6.amd64
  • pywin32-218.win-amd64-py2.7
  • mercurial-2.8.2.tar
  • Windows Server 2008 R2

I've added the python and python\\scripts folder to the 'Path' Environment Variable.

When I get to the point where I need to compile hgwebdir_wsgi.py into a DLL, using an Administrative command prompt I attempt to compile hgwebdir_wsgi.py and I get the following error:

C:\inetpub\wwwroot\hg>python hgwebdir_wsgi.py
Traceback (most recent call last):
  File "hgwebdir_wsgi.py", line 73, in <module>
    application = hgwebdir(hgweb_config)
  File "C:\Python27\lib\site-packages\mercurial\hgweb\hgwebdir_mod.py", line 89,
 in __init__
    self.refresh()
  File "C:\Python27\lib\site-packages\mercurial\hgweb\hgwebdir_mod.py", line 98,
 in refresh
    u = ui.ui()
  File "C:\Python27\lib\site-packages\mercurial\ui.py", line 45, in __init__
    for f in scmutil.rcpath():
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 102, in _
_getattribute__
    self._load()
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 74, in _l
oad
    mod = _hgextimport(_import, head, globals, locals, None, level)
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 43, in _h
gextimport
    return importfunc(name, globals, *args)
  File "C:\Python27\lib\site-packages\mercurial\scmutil.py", line 290, in <modul
e>
    class vfs(abstractvfs):
  File "C:\Python27\lib\site-packages\mercurial\scmutil.py", line 318, in vfs
    @util.propertycache
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 102, in _
_getattribute__
    self._load()
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 74, in _l
oad
    mod = _hgextimport(_import, head, globals, locals, None, level)
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 43, in _h
gextimport
    return importfunc(name, globals, *args)
  File "C:\Python27\lib\site-packages\mercurial\util.py", line 27, in <module>
    cachestat = platform.cachestat
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 102, in _
_getattribute__
    self._load()
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 74, in _l
oad
    mod = _hgextimport(_import, head, globals, locals, None, level)
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 43, in _h
gextimport
    return importfunc(name, globals, *args)
  File "C:\Python27\lib\site-packages\mercurial\windows.py", line 36, in <module
>
    posixfile.__doc__ = osutil.posixfile.__doc__
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 102, in _
_getattribute__
    self._load()
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 74, in _l
oad
    mod = _hgextimport(_import, head, globals, locals, None, level)
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 43, in _h
gextimport
    return importfunc(name, globals, *args)
ImportError: DLL load failed: %1 is not a valid Win32 application.

The answers to most of the related questions are 32bit vs 64bit problems: however, I've used the 64 bit versions of both Python and Pywin, and built mercurial from the source (or, am attempting to). Why is my compile failing?

I was not able to troubleshoot the issue with this version of Mercurial. What ended up working was both

  1. Using a slightly older version of Mercurial
  2. Switching to 32 bit everything.

Even though I was careful installing only 64 bit versions before, I think that somewhere along the line a 32 bit version got added - at least, that's what I assume, because 32 bit worked right out of the gate. I doubt the older version of Mercurial was the reason it worked, but I did change the version so I included that in my answer.

My advice to anyone else having this problem: Switch to uniform 32 bit, regardless of your processor.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM