热情软件屋

 

VC5中为Isapi提供了什么调试工具


编号:QA000873
建立日期: 1999年4月27日 最后修改日期:1999年4月27日
所属类别:

林建国:
    Visual C++5.0,pws服务器管理
    pwin98
    我在编写Isapi扩展时,使用了VC5提供的例程wwwquote中的CQuote类的成员函数LoadLongString,但是函数返回的结果始终是false,显示的是can not find resource 104。函数的第二个参数是一个html文档资源标识。另外,我在建立html文档资源时自定义的资源类型名(我用的是23)始终有引号,不知是否有影响.我将szName设成html或myhtml都不行。
    不知VC5中为Isapi提供了什么调试工具?

回答:

    If you have written an Internet Server extension DLL, you might be interested in getting it running under the debugger so you can trace its execution, set breakpoints, or monitor variable values after the extension is called. Getting the Microsoft Internet Information Server (IIS) up and running with your DLL in the debugger is 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.
    Because of differences between version 3.0 and 4.0 of IIS, it is important to know which version you will be using to debug your DLL.
    Debugging Using Internet Information Server (3.0 and earlier)
    Debugging Using Internet Information Server (4.0 and later)
    Debugging Using Internet Information Server (3.0 and earlier)
    Follow these steps to debug an Internet Server extension DLL using IIS 3.0:
    Stop the IIS publishing services by using the IIS 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 want to make the services "Manually" started in Control Panel so you can avoid this step later in your development.
    Start Microsoft Visual C++, and click the Close Workspace command on the File menu to close any opened workspace.
    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.
    On the Project menu, click Settings, then click the Debug tab in the Project Settings dialog box.
    With General selected in the Category box, type the following in the Program Arguments text box:
    -e W3Svc
    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.
    Click OK to close the Project Settings dialog box.
    Make sure that the .PDB file for your DLL is in the same directory as the DLLs you plan to debug.
    Debugging Tips
    The IIS can be run as an interactive application, making debugging 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. (If you're using Windows NT 3.51, run MUSRMGR.EXE. If you're using Windows NT 4.0, run USRMGR.EXE.) Click User Rights from the Policies menu. Select the Show Advanced User Rights check box. Then select Act as part of the operating system from the drop-down list on the right, and add the user account.
    Repeat this process with Generate Security Audits (also in the drop-down list on the right). Make sure that all Internet Services (WWW, ftp, and gopher) are stopped and INETINFO.EXE is not running (use TLIST to check). Log off and log back on. You can then load the IIS with the command line:
    INetInfo.Exe -e W3Svc
    To load IIS under a debugger (for example, under WinDbg), use the following command line:
    WinDbg INetInfo.Exe -e W3Svc
    You are ready to go. In Visual C++, point to Debug on the Build menu and then click Go. This action starts the WWW publishing service, and the debugger will be aware of symbols in your DLL. You can ignore the warning that the file doesn't have debugging information.
    When you close Visual C++, save the workspace for INETINFO.EXE. That way, you can avoid reentering the settings for the debugging session. 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 0, the server will always reload extension DLLs each time they are used.
    Forcing the server to reload your DLL is 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 little effort. Be sure to test your DLL using the normal CacheExtensions setting, however, to make sure code in your DLL isn't completely dependent on that initial state.

此问题由Leo Liu回答。

 
把这个问题推荐给朋友
   
   
您的意见类别
您的名字
您的电子邮件
您的建议(请尽可能详细)
 
 

版权所有 1997-2008 热情软件屋
如果您有任何建议和意见, 请给我发个电子邮件 askpro@china-askpro.com
Web Designed by ZebraStudio