Export (0) Print
Expand All

How to: Debug COM+ 1.0 Components 

This topic applies to:

Visual Studio Edition

Visual Basic

C#

C++

J#

Express

No

No

Native

No

Standard

No

No

Native

No

Pro/Team

No

No

Native

No

NoteNote

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

In Visual C++, you can create an ATL project that supports COM+ 1.0 components. To debug a COM+ component project in Visual Studio, you need to attach to the DLLHOST.EXE process. The following steps assume that you have a COM+ component that is a server and a client project that uses the COM+ component server. Both projects are in the same Visual Studio solution.

To debug COM+ 1.0 components

  1. Build the COM+ component if you have not already done so.

  2. Enable multiple launch.

    1. In Solution Explorer, right-click the solution, and click Properties on the shortcut menu.

    2. In the <Solution name> Property Pages dialog box, expand the Common Properties node, and select Startup Project.

    3. Click the Multiple Startup Projects button.

    4. In the Project grid, for both the client and component projects, choose Start in the Action column.

    5. Click OK.

  3. Get the Application ID for the COM+ Component.

    1. On the Start menu, click Control Panel.

    2. In Control Panel, double-click Administrative Tools.

    3. In the Administrative Tools window, double-click Component Services.

    4. In the Component Services window, open the Component Services node and continue opening until you reach the COM+ Applications folder.

    5. Open the COM+ Applications folder, and find the node for your COM+ component.

    6. Right-click the node corresponding to your COM+ component node, and on the shortcut menu, click Properties.

    7. In the COM+ component Properties dialog box, find the application ID, which looks something like this:

      Application:      {3D14228C-FBE1-11D0-995D-00C04FD919C1}
      
    8. Copy the Application ID, and click Cancel.

  4. Set the COM+ component project to attach to your component under DLLHOST.EXE.

    1. In Solution Explorer, right-click the component project, and on the shortcut menu, click Properties.

    2. In the <Project name> Property Pages dialog box, open the Configuration Properties folder, and select the Debugging category.

    3. In the Command box, type the following:

      dllhost.exe
      
    4. In the Command Arguments box, type the argument /ProcessID followed by the Application ID. For example:

      /ProcessID:{3D14228C-FBE1-11D0-995D-00C04FD919C1}
      
    5. Click OK.

    6. Close the Component Services window.

      NoteNote

      The application ID will be unique for each machine where the component is registered, so you will need to repeat these steps if you later debug the component on another machine.

    You can now set breakpoints, start the debugger, and begin making calls to your component. If you are using transactions, you might also want to increase the transaction timeout, which defaults to 60 seconds. You can also specify a value of 0, effectively specifying an infinite transaction timeout period.

To change the timeout value

  1. From the Start menu, click Settings, and then click Control Panel.

  2. In Control Panel, double-click Administrative Tools.

  3. In the Administrative Tools window, double-click Component Services, and then open the Component Services node, followed by the Computers folder.

  4. In the Computers folder, right-click My Computer, and on the shortcut menu, click Properties.

  5. In the My Computer Properties dialog box, click the Options tab.

  6. In the Transaction timeout (seconds) box, edit the timeout value.

  7. Click OK.

  8. Close the Component Services window.

    When you are finished debugging, you should shut down the COM+ applications you are debugging. If a server process is left running, you might get an error message the next time you try to build a DLL when the existing DLL is still loaded in memory.

To shut down a COM+ application running as a service

  1. On the Start menu, click Settings, and then click Control Panel.

  2. In Control Panel, double-click Administrative Tools.

  3. In the Administrative Tools window, double-click Component Services.

  4. In the Component Services window, select Services (local).

  5. In the Services (local) list, right-click the service name, and on the shortcut menu, click Stop.

  6. Close the Component Services window.

See Also

Community Additions

ADD
Show:
© 2014 Microsoft