How to debug isapi extension using delphi debugger?

I am trying to debug an ISAPI extension written in Delphi. The extension works just fine, however I can't debug it (i.e. set a breakpoint and step through the code).

Here's what I did:

  • Launched Delphi Rad Studio as Administrator.
  • Make sure the extension is loaded by accessing it in your browser.
  • Selected launch -> attach to process.
  • Selected the w3wp.exe process (no pause after attaching)
  • Set a breakpoint at the start of the default handler action
  • Tried to get expansion again

However, the breakpoint is never triggered in my handler (see the figure below):

enter image description here

+3


source to share


1 answer


Your approach has a limited utility because you can only start debugging AFTER your application has started. If you need to debug it from the first request, it is useless. This is how you should:

Setting up IIS:

1) In IIS, create a new web application under Default Web Site.

2) Each application in the Default Website section must use the same Application Pool, DefaultAppPool. Make sure this application pool can run the ISAPI application without debugging. If you cannot run an ISAPI application using it, you also cannot debug it.

Application setup (Delphi IDE):

Setting up an application in Delphi (any XE + IDE has similar settings)



1) Run Delphi as Administrator. Not really necessary, but it makes a lot easier and avoids a lot of problems.

2) In Delphi Ide, select Run -> Parameters. Inform the host application and parameters, as you can see in the following picture:

Configuring a Delphi Application for ISAPI Debugging W3WP.exe is the IIS worker process executable and we will run it interactively to debug the ISAPI application. Remember that there are two versions of w3wp.exe: one 32-bit under C: \ Windows \ SysWow64 and another 64-bit under C: \ Windows \ System32. You must use the correct version for your application.

3) Stop the Internet Publishing Service. You can use "net stop W3SVC" from an elevated command prompt or use the Windows Services Console.

Once W3SVC is stopped, simply launch the application from the Delphi IDE and call it from your browser. When the application should load and all of your breakpoints will be activated. You can debug like any other Delphi application.

+11


source







All Articles