Debug ISAPI DLL!!!!

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?
Who is Participating?
rakeshkalraConnect With a Mentor Commented:
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.

spacedog2Author Commented:
I found a much easier method off of!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.