Debug ISAPI DLL!!!!

Posted on 1998-10-23
Last Modified: 2013-11-20
How do I debug a ISAPI Dll with IIS 4.0 & Visual C++ 5.0?

I have tried all the tricks that work with C++ 4.0..and IIS 1/2....but how do I debug with the NEW stuff?
Question by:spacedog2

Accepted Solution

rakeshkalra earned 100 total points
ID: 1323786
Getting the Microsoft Internet Information Server up and running with your DLL in the debugger is possible, but a little tricky. You will need to first find a quiet server where you can debug your DLL in a controlled setting. Once you've found such a resource, you can start debugging your DLL by following these steps:

1.Stop the Internet Information Server publishing services by using the Internet Information Server Manager, or by stopping the services with the Services icon in the Windows NT Advanced Server Control Panel. Note that you must stop all three services even though you are only debugging extensions to the World-Wide Web publishing service. To make things easier, you might wish to make the services "Manually" started in Control Panel so you can avoid this step later in your development.

2.Start Microsoft Developer Studio, and click the Close Workspace command on the File menu to close any opened workspace.

3.On the File menu, click Open Workspace to open the INETINFO.EXE program. This file is in the directory where you installed the Microsoft Internet Information Server.

4.On the Build menu, click Settings, then click the Debug tab in the Project Settings dialog box.

5.With General selected in the Category box, type the following in the Program Arguments text box:

-e W3Svc

6.Choose Additional DLLs from the Category drop-down list. Then, in the Local Names box, specify the complete path and name of your extension DLL or DLLs. Make sure the check box next to each is marked.

7.Click OK to close the Project Settings dialog box.

8.Make sure that the .PDB file for your DLL is in the same directory as the DLLs you plan to debug.

Debugging Tips
The Internet server can be run as an interactive application. This makes debugging it much easier. To do this you need to make a few changes to your system. For the user account that you are going to run the server under, you need to add a few privileges.

To add privileges, run User Manager (MUSRMGR.EXE), and select User Rights from the Policies menu. Check the Show Advanced User Rights check box. Then select "Act as part of the operating system" from the Right drop-down list, and add the user account.

Repeat this process with "Generate Security Audits" (also in the Rights drop-down list). Make sure that all Internet Services (WWW, ftp & gopher) are stopped and INetInfo.Exe is not running (use TLIST to check). Log off and log back on. You can then load the Internet Server with the command line:

INetInfo.Exe -e W3Svc

If you want to load this under a debugger just make sure that the command line to INetInfo.Exe is "-e W3Svc". (For example, to load it into WinDbg the command line is: WinDbg INetInfo.Exe -e W3Svc

You are ready to go. In Developer Studio, point to Debug on the Build menu and then choose Go. This action starts the WWW publishing service, and the debugger will be aware of symbols in your DLL. You'll get a warning that this file doesn't have debugging information in it, but you can ignore that message.

When you leave Microsoft Developer Studio, you will probably want to make sure that you let Developer Studio save the workspace for INETINFO.EXE. This will let you avoid reentering all of the settings you need to make—instead, you can just open the INETINFO.MDS workspace file when you are ready to start the debugger again.

Cached DLLs
You can adjust the registry setting at HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/W3SVC/Parameters/CacheExtensions to have the server reinitialize DLLs each time they are used. If this setting is 1, the server will keep DLLs loaded in memory as long as possible. This is the default setting for the server, since it helps the server achieve peak performance, and should only be changed if you are using the server for debugging. If you make the setting zero, the server will always reload extension DLLs each time they are used.

Forcing the server to reload your DLL is very helpful when your DLL might be crashing or upsetting any per-instance data that it maintains. By forcing the server to reinitialize the DLL, you can get your DLL back into a predictable state with very little effort. You should make sure you test your DLL using the normal CacheExtensions setting, however, to make sure code in your DLL isn't completely dependent on that initial state.


Author Comment

ID: 1323787
I found a much easier method off of!

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now