2010. március 7., vasárnap

Debugging IIS5 the easy way


IIS debugging is kind of painful... until you understand what is going on behind the scenes!



If you developed ISAPI dlls and tried to debug them under IIS5 you probabily went trough one of the most painful exercises on the Windows platform. "What doesn't kill you makes you stronger" they say, but there is a limit in my opinion. Well, tonight after having unsuccesfully tried all the "how-to"s on the web, I dediced to see what is going on and why it is (apparently) that difficult.

It turned out that it's very simple and what happens behind the scenes in nothing but regular COM stuff. The key steps are just 3. It's as easy as that! No registry changes or anything else.

Setting up the debugging environment

In this example I will assume your ISAPI dll runs in a virtual directory called "DebuggingIIS".

Open the Internet Services Manager utility located under Control Panel\Administrative Tools.

Find your virtual directory and after right-clicking on it and selecting "Properties" change it's Application protection to "High" as in the following screenshot.

What happened after you did it is IIS created a special COM+ application which will be responsible for loading your ISAPI dlls and everything that as to do with your virtual directory.

If you open up the Component Services up will see this:

Now, right click on the COM+ Application, select "Properties"  and follow me through 2 additional steps before we are ready to start debugging directly from Delphi.

The first page that will appear is the following:

You will need the Application ID in Delphi so copy it by right clicking on it.

Now move to the page Identity and switch the default setting to "Interactive User" as for the following screenshot:

Belive it or not, we are done with IIS and COM+

Now you can go in your Delphi ISAPI project and after clicking on Run\Parameters enter the following parameters:

The value after ProcessID is the Application ID we copied in the Application Services snap in.

Happy debugging!

Nincsenek megjegyzések:

Megjegyzés küldése