Microsoft Knowledge Base Email Alertz

(195957) - When you instantiate a COM component in an out-of-process server (.exe) from Active Server Pages (ASP), another instance of the .exe starts.

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 195957 - Last Review: March 16, 2005 - Revision: 3.3

PRB: Instantiating Object in .exe Starts Another .exe Instance

This article was previously published under Q195957

On This Page

SYMPTOMS

When you instantiate a COM component in an out-of-process server (.exe) from Active Server Pages (ASP), another instance of the .exe starts.

CAUSE

The default Identity of a COM component in an .exe is the Launching User. The implication of this is that when the Active Server Pages page tries to create an instance of this object, it is doing so in the security context of the anonymous user (IUSR_<machine name>). If this is a different user from the user that started the instance of the .exe that is currently running, another instance of the .exe starts.

RESOLUTION

Step-by-Step Procedures

  1. From the Start menu, click Run, and enter the following in the Open text box:
    dcomcnfg
  2. In the Distributed COM Configuration Properties dialog box, click the Applications tab.
  3. Select the object from the list and double-click on it.
  4. In the Properties dialog box that appears, click the Identity tab. Note that the default setting is the Launching User.
  5. Change this setting to a specific Windows NT user account of your choice by selecting This User and entering the user name and password.
  6. Click OK, and then click OK again.
  7. Run the Active Server Pages page.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a Visual Basic ActiveX .exe named TwoInstances, add a class module named TestObject and implement the following method:
          Public Sub AnyMethod
            'Do Anything
          End Sub
    
    						
  2. Create a Visual Basic Standard .exe, include a reference to TwoInstances.TestObject, add a command button (Command1) to the default form, and type the following in the Click event of the command button:
          Private Sub Command1_Click()
            Dim objTest As TwoInstances.TestObject
    
            Set objTest = New TwoInstances.TestObject
            objTest.AnyMethod
            Set objTest = Nothing
    
          End Sub
    
    						
  3. Create an Active Server Pages page with the following code:
          <%
             Set objTest = Server.CreateObject("TwoInstances.TestObject")
             objTest.AnyMethod
             Set objTest = Nothing
          %>
    
    						
  4. Start the Task Manager, and click the Processes tab.
  5. Run the Visual Basic Standard .exe. Note the running instance of the .exe in the Task Manager.
  6. Run the Active Server Pages page.
RESULT: Another instance of the .exe appears in the Task Manager.

APPLIES TO
  • Microsoft Active Server Pages 4.0
  • Microsoft Visual C++ 5.0 Enterprise Edition
  • Microsoft Visual C++ 6.0 Enterprise Edition
  • Microsoft Visual C++ 5.0 Professional Edition
  • Microsoft Visual C++ 6.0 Professional Edition
  • Microsoft Visual C++, 32-bit Learning Edition 6.0
  • 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 Enterprise Edition for Windows 6.0
  • Microsoft Internet Information Server 3.0
  • Microsoft Internet Information Server 4.0
  • Microsoft Internet Information Services 5.0
Keywords: 
kbcodesnippet kbinetdev kbprb KB195957
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate