Setting up Visual Studio 2008 for Compiling 64-bit DLLs

date:2010-04-16 10:17
author:admin
category:bugs, programming
tags:64bit, bugs, c++, compiling, service pack, visual studio
slug:setting-up-visual-studio-2008-for-compiling-64-bit-dlls
status:published

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

image5

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…

image9

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).

image14

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.

orphan:

Comments

http://www.gravatar.com/avatar/2643e328972eed9c07b7ec3bb9b4b964?s=55&d=identicon&r=g

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?

Reply
http://www.gravatar.com/avatar/ec399a4765f732e1a2acd5ca7edd0fd5?s=55&d=identicon&r=g

2. geographika **

Hi Cyrus,

On the downloads page there are a few options:

PyISAPIe-1.1.0-rc4-Source.zip
PyISAPIe-1.1.0-rc4-Py2.6.zip
PyISAPIe-1.1.0-rc4-Py2.5.zip

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.

Reply
http://www.gravatar.com/avatar/2643e328972eed9c07b7ec3bb9b4b964?s=55&d=identicon&r=g

3. Cyrus **

@geographika

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 hello.py script and I have also been able to copy the ISAPI.py file into my root directory and given it the name rundjango.py. Then when I hit http://mysite.com/rundjango.py I get the “Welcome to Django” screen. But how do I get the PyISAPI/ISAPI connective stuff to know when I hit http://mysite.com/myapp/ that this is python/django?

Reply
http://www.gravatar.com/avatar/2643e328972eed9c07b7ec3bb9b4b964?s=55&d=identicon&r=g

4. Cyrus **

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

Reply
http://www.gravatar.com/avatar/52a7495eeb9152acb2a39c9f0e83cfd9?s=55&d=identicon&r=g

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,

Jonathan

Reply
http://www.gravatar.com/avatar/ec399a4765f732e1a2acd5ca7edd0fd5?s=55&d=identicon&r=g

6. geographika **

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

problems. | Both http://sei.maps.ie/wind and http://sei.maps.ie/geothermal 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).

Reply
http://www.gravatar.com/avatar/?s=55&d=identicon&r=g

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. [...]

Reply
http://www.gravatar.com/avatar/?s=55&d=identicon&r=g

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 [...]

Reply
http://www.gravatar.com/avatar/9e74650e99099d9a650364cbbdca8d59?s=55&d=identicon&r=g

9. joss **

A quick hack I found very useful was to modify Http/Isapi.py 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]()
Reply
http://www.gravatar.com/avatar/a14efba45be6281f9699e2b614a031ec?s=55&d=identicon&r=g

10. Josh **

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

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

Reply
http://www.gravatar.com/avatar/5f8c9e73a0c51b69da6c4881cefe457c?s=55&d=identicon&r=g

11. chris **

@geographika
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 tilecache.py has to be changed?

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

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\Isapi.py”, line 49, in Request
raise ImportError, “[Loading ‘%s’] %s” % (Env.SCRIPT_TRANSLATED,

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

Reply
http://www.gravatar.com/avatar/ec399a4765f732e1a2acd5ca7edd0fd5?s=55&d=identicon&r=g

12. geographika **

Hi Chris - I uploaded my TileCache script to http://bitbucket.org/geographika/mapserver-scripts/changeset/40e84703a58d

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.

Reply
http://www.gravatar.com/avatar/?s=55&d=identicon&r=g

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 [...]

Reply
http://www.gravatar.com/avatar/27fcfd8c3cba0ca7986d3e1e07a79ffe?s=55&d=identicon&r=g

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.

Reply
http://www.gravatar.com/avatar/?s=55&d=identicon&r=g

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 [...]

Reply
http://www.gravatar.com/avatar/24b02e0a84d2ca3af8ea44686298fb58?s=55&d=identicon&r=g

16. Vaibhav **

Hi,
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.

Reply
http://www.gravatar.com/avatar/50c6f8a0bee5604bd504c7279f8b2cf6?s=55&d=identicon&r=g

17. Detzler **

HTTP Error 404.17 – Not Found

Reply
http://www.gravatar.com/avatar/?s=55&d=identicon&r=g

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

[...] Setting up Python on IIS7 – http://geographika.co.uk/setting-up-python-on-iis7 [...]

Reply
http://www.gravatar.com/avatar/a8b8ea92ee5b6f777a9a54f2c0d8397f?s=55&d=identicon&r=g

19. Ritesh Chandora **

Tried everything mentioned.... but no success..
Pythong 2.6
IIS 7
django 1.5.5

Am I missing something???

Reply
http://www.gravatar.com/avatar/a8b8ea92ee5b6f777a9a54f2c0d8397f?s=55&d=identicon&r=g

20. Ritesh Chandora **

windows server 2008R2

Reply
Add Comment