8

I'm running Delphi XE on Windows 7 Pro 64 and IIS 7.5, developing an ISAPI application. IIS is configured correctly (including allowing 32-bit code to run in an ISAPI process). The ISAPI process runs properly.

In Delphi I'm trying to attach to the ISAPI process running on localHost to step through my ISAPI.dll code: Run->Attach to Process->InetInfo.exe.

I've done this a thousand times with Windows XP and IIS 5, but in this new environment I cannot attach to the ISAPI process. I get an error message in the IDE when attempting to attach:

Unable to create process - the request is not supported

This is costing me lots of time — I have to pump out debug strings for every line of code, run the app, and then look at my debug strings, etc.

Why can't I attach to the ISAPI process? Is this is an IIS 7.5 configuration issue? Perhaps related to 32/64-bit problems because IIS is native 64-bit and Delphi debugger is 32-bit?

Vector
  • 10,879
  • 12
  • 61
  • 101
  • I'd suspect you're right about it being an issue with 64-bit IIS and the 32-bit debugger. Not sure how to tell you to work around it, though, unless you can do something with TD debugging info and Visual Studio. – Ken White May 05 '11 at 15:30
  • Not very helpful..... But can't you just run IIS inside a 32bit VM? – Warren P May 05 '11 at 18:26
  • Make sure that you fully understand the Worker Process Isolation Mode first introduced in IIS 6 (of course for IIS 7 and above). Then you should know it is wrong to attach to inetinfo.exe after so many years. – Lex Li May 12 '11 at 06:08
  • @Lex Li - never had any problems attaching to inetinfo in IIS 5 (as I mentioned in my question) which I use on my XP development machines. Since IIS 6 is only available on Server 2003, I don't think I've ever debugged through IIS 6,which I didn't mention at all. If the design changed in IIS 6 precluding attaching to inetinfo, that's a different matter. So what is the solution? How do I hook into the specific process running my DLL? How is the process named? Tnx. – Vector May 12 '11 at 14:25
  • @Mikey, I did provide an answer below with a link to process model. w3wp.exe is the one that you should attach to. – Lex Li May 13 '11 at 04:17

5 Answers5

3

Learn it here, http://blogs.msdn.com/b/david.wang/archive/2006/06/21/isapi-filter-and-the-iis6-process-model.aspx

To make it clear, in iis worker process isolation mode, w3wp.exe is the process that loads your isapi filters, so you should attach to it instead of inetinfo.exe.

Lex Li
  • 60,503
  • 9
  • 116
  • 147
2

You can debug your 32 bit ISAPI dll on a x64 bit machine by setting the "Enable 32 bit application" to true in the advanced app pool settings in IIS 7.5.

In Delphi you specify the "C:\Windows\System32\inetsrv\w3wp.exe" as the host application with the params "-debug". Start the Delphi IDE as admin and off you go. If you need more control over how w3wp is started you figure out available options using the command C:\Windows\System32\inetsrv\w3wp.exe -?

Hope this helps!

  • umm - thanks - this question was answered a year ago.... also, of course it has to be a 32 application, but thanks for the help. – Vector May 11 '12 at 15:47
2

You might wanna check this out: http://www.embarcadero.com/products/delphi/64-bit

Olaf Monien
  • 664
  • 4
  • 10
  • thanks - I already signed up for the beta program! But that's not going to help much now. Cannot use the beta 64 bit compliler in my production code. – Vector May 06 '11 at 13:11
2

If IIS 64bit is using an ISAPI.DLL which is a 32-bit module, it must be using an 32bit loader process. You could use ProcessExplorer to find which process is loading your ISAPI.DLL and attach Delphi to that process.

Fabricio Araujo
  • 3,810
  • 3
  • 28
  • 43
  • This is because, this time, MS didn't provide thunking mechanisms allowing communication between 64bit and 32bit modules - they did this when people were moving from 16bit to 32bit worlds (maaaaany moons ago). – Fabricio Araujo May 11 '11 at 22:25
1

You can debug your Delphi ISAPI Web Application under IIS 7.5 with the following tool http://www.eggcentric.com/ISAPIDebug.htm. (You will need to set up the ISAPIFwd.ini file)

Paul Klink
  • 66
  • 2
  • Thanks for the link - looks like something I could use and I'll check it out - but I'm sure it will be a big pain in the butt to get it working in IIS 7.5... – Vector May 13 '11 at 05:04
  • No - it is easy - just follow the instructions. I use it to debug a number of ISAPI applications under Windows 7, IIS 7.5. – Paul Klink May 15 '11 at 05:11