Microsoft KB Archive/238786

= How To Perform Remote Debugging With VB DCOM Servers =

Article ID: 238786

Article Last Modified on 7/1/2004

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Learning Edition
 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q238786



SUMMARY
At times it can be desirable to step through the code of a DCOM Server as it is being accessed by a remote client application. This article describes how to debug a DCOM server created with Visual Basic as it is being accessed by a client application on a second computer.



MORE INFORMATION
This article assumes that the reader already knows how to create a DCOM server application and how to distribute and install the client on a remote computer. See the REFERENCES section for more information.

The following steps discuss how to set up a client application and a DCOM server for remote access debugging.
 * 1) Create a DCOM Server, save the project and compile it.
 * 2) Create a client for your server. Save the project and compile it.
 * 3) Create the distribution files for the client.
 * 4) Install the client on a remote computer.
 * 5) Make all needed settings using Dcomcnfg on the client and server computers.
 * 6) Test the client with the compiled server to assure the DCOM connection is working fine.
 * 7) Close the client. You are now ready to start debugging.
 * 8) Assure the server is not running. You can use Task Manager for this purpose.
 * 9) Start Visual Basic and open your Server project.
 * 10) From the Project menu, select Properties and choose the Component Tab. Assure that Binary Compatibility is set.
 * 11) While still in Properties, select the Debugging tab. Check the Wait for components to be created option and click OK.
 * 12) Place breakpoints as required.
 * 13) Press F5 to run the server.
 * 14) Start the client.
 * 15) At this point, you should be running the Server in the Visual Basic IDE. The process will break as soon as a breakpoint is reached. You can now debug the server as any other application in the IDE.
 * 16) Once you close the client, the server will continue to be loaded in the IDE. To end the server, from the Run menu select End.

Important Security Issues
When your server is running in Visual Basic's IDE, it runs in the security context of Visual Basic. This means that the settings you have chosen for your server using Dcomcnfg are not effective at this time. The identity of the server at this point will be the interactive user. In addition, you cannot set access rights to Visual Basic. As a consequence, the only user that can access the server running in the IDE is the user that is logged on to the computer where the server is running. In other words, the user logged on to the computer where the client is running must be the same user that is logged on to the computer where the server is running.

