Setting up Visual Studio 2008 for Compiling 64-bit DLLs


2010-04-16 10:17




bugs, programming


64bit, bugs, c++, compiling, service pack, visual studio





This step should be simple. Run the Visual Studio 2008 SetUp program and check the “X64 Compilers and Tools” option under Visual C++


However firstly don’t run the set up program from the DVD or from an ISO on your hard-disk or you’ll end up with the following error:

‘A problem has been encountered while loading the setup components. Canceling setup’

You need to run the Visual Studio set up through Add/Remove Programs. However once I’d selected the components I got the error below - “A selected drive is no longer valid. Please review your installation path settings before continuing with setup.” Of course *there is no* *option* to review or even see your drive settings…


Thanks to this thread, the solution was to uninstall Visual Studio SP1 through Add/Remove programs (check the “Show Updates” box to see service packs and hot fixes for various programs).


Finally I got the 64-bit compilers installed, and could begin trying to compile PyISAPIe for a 64-bit processor which is a whole different set of problems.



1. Cyrus **

Thanks for the post!!! I was having the same trouble finding anything about IIS 7 and Python. I am really just wadding into the IIS waters. I can find everything and follow your whole post except for one thing, the DLL file. I downloaded the PyISAPIe package and I have files that end in .h,def, and sln but no dll. Do I have to make this file?


2. geographika **

Hi Cyrus,

On the downloads page there are a few options:

The first is the sourcecode for the DLL (C++ and Visual Studio solution files). The second two point to the DLLs - select Py2.6 or Py2.5 depending on your installed Python version. These downloads contain the compiled DLLs.


3. Cyrus **


Thanks for that. I seem to have a common problem with many django-to-ISS wranglers and that is how to properly connect the two together. I was wondering if you had solved the riddle completely. I can run the script and I have also been able to copy the file into my root directory and given it the name Then when I hit I get the “Welcome to Django” screen. But how do I get the PyISAPI/ISAPI connective stuff to know when I hit that this is python/django?


4. Cyrus **

Nevermind, I got it working. Needed the most up to date Pyisapie files. Then had to mod for django 1.0. Thanks!


5. Jonathan **

Great Stuff. I was playing with this about two months ago and came to an abrupt halt - python was proving too much of a learning curve. Just to confirm - have you defintely got tilecache working with this set up - and if do - how does it compare with mod_apache?

All the best,



6. geographika **

TileCache has been running for a couple of months now without any

problems. | Both and are using caches. | I had both Apache and IIS running the same .map files on the same Windows 2008 64-bit server. | I used JMeter to test the performance between the two, but after a few consecutive requests Apache froze. I wasn’t able to find out why, but IIS and ISAPI were able to handle anything I threw at it. | I’d strongly recommend using IIS if using Windows. You can also take advantage of the 64-bit MapServer (although a 64-bit Python version is not yet ready as far as I know).


7. geographika » Reboot to Refresh Environment Variables **

[…] This knowledge may save a couple of hours of frustration if you are running Python scripts on IIS through PyISAPIe. […]


8. geographika » Compiling a 64 bit Version of PyISAPIe **

[…] then set up the PyISAPIe.DLL on IIS7 (using the same process as I detailed here), replacing the 32-bit DLL with my newly compiled 64-bit, and using the DefaultAppPool which should […]


9. joss **

A quick hack I found very useful was to modify Http/ such that it reloads the file if you have modified it:

from PyISAPIe import Env
from hashlib import md5
import imp
from os import stat
Handlers = {}
TimeMap = {}
def Request():
Script = Env.SCRIPT_NAME
Key = Name = ‘__’+md5(Script).hexdigest().upper()
Handler = Handlers.get(Key, None)
mtime = stat(Env.SCRIPT_TRANSLATED[4:])[8]
if not Handler or TimeMap[Key] < mtime:
Handlers[Key] = imp.load_source(Key, Env.SCRIPT_TRANSLATED).Request
TimeMap[Key] = mtime
return Handlers[Key]()

10. Josh **

Cyrus, can you describe what you did here? How does IIS know to run

the file of you do not specify the filename on the command line?


11. chris **

first of all: I like your blog and your simple way to explain things,

I guess you did already safe some people some time!

you said, that you were able to get TileCache running on IIS7 with PyISAPIe. Could you give me a hint, how the original has to be changed?

from TileCache import Service, cgiHandler, cfgfiles
if __name__ == ‘__main__’:
svc = Service.load(*cfgfiles)

I guess, since it isn’t a CGI script, that has to be adopted… currently I get:

Request handler failed

Traceback (most recent call last):
File “C:\Python25\PyISAPIe\Http\”, line 49, in Request
raise ImportError, “[Loading ‘%s’] %s” % (Env.SCRIPT_TRANSLATED,

str(Val)) | ImportError: [Loading ‘\\?\C:\inetpub\wwwroot\tilecache\’] ‘module’ object has no attribute ‘argv’


12. geographika **

Hi Chris - I uploaded my TileCache script to

Let me know how you get on. I’ll try and turn my notes into a post at some point. I think there were a couple of changes I have to make in the TileCache scripts themselves due to Python errors.


13. geographika &raquo; Using TileCache on IIS **

[…] previously written about using PyISAPie to run Python under IIS - this allows Python scripts to run faster than using CGI. Rather than starting up the Python […]


14. Timothy Walker **

Very good example. Found another good site that shows exactly how to setup CGI II7 and C++, along with your example I have finally setup a nice web host to host my own site! DynDNS offers nice services to do this. There is something generic about have others like GoDaddy host your web site, especially if you are a 7 language programmer! I am not a web master, but I do have 20 years of C++ so why not host my own site! Others can do so as well, but the hardest part of it is finding clear concise examples, and Microsoft does not offer anything close to this. You are wasting your time if you think MS can give you any good help for free! This is the beauty of the web, people like us that can offer better help than major corporations! For free that is.


15. MapFish Print Module for IIS at geographika **

[…] and configure PyISAPIe. You can follow the instructions described on this post or in the README file included with PyISAPIe . If you want to run a 64 bit version, have a look at […]


16. Vaibhav **

Thanks for this article, it seems to be very useful.
I’m getting below error
HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by

the static file handler.

It would be really good if you could provide any pointers as to what is missing which causes this issue. Thanks in advance.


17. Detzler **

HTTP Error 404.17 - Not Found


18. wolf++ &raquo; Running Django on Windows: Python 2.7.2 x64, PyISAPIe and IIS 7.5 **

[…] Setting up Python on IIS7 - […]


19. Ritesh Chandora **

Tried everything mentioned…. but no success..
Pythong 2.6
django 1.5.5

Am I missing something???


20. Ritesh Chandora **

windows server 2008R2

Add Comment