PRB: "Permission Denied" Using WithEvents and DCOM on WIN95

Last reviewed: January 26, 1998
Article ID: Q179835
The information in this article applies to:
  • Microsoft Visual Basic Control Creation, Learning, Professional, and Enterprise Editions for Windows, version 5.0 on the following platform: Win95

SYMPTOMS

Receiving Error 70: "Permission Denied."

CAUSE

The client application has referenced a remote server class using the keyword WithEvents. When the server attempts to raise an event to the remote client, it attempts to identify itself to the client before it can raise the event. Remote access is not being granted to the server; therefore, the error occurs.

RESOLUTION

You can enable a WIN95 DCOM client to receive remote events by adding "The World" user to the client machines default security group using DCOMCNFG.EXE and setting it to "Access Granted."

The DCOM configuration that needs to occur for an NT server (or workstation) to communicate with a Win95 client application is the following:

On the DCOM SERVER using DCOMCNFG.EXE:

  1. Select the server ProgID or GUID.

  2. Click Properties, select the Security Tab, and then make the following changes:

    CUSTOM ACCESS PERMISSIONS:

         Everyone  -allow access
    
         System     -allow access
         Interactive -allow access
    
       CUSTOM LAUNCH PERMISSIONS:
         Everyone  -allow launch
         System     -allow launch
         Interactive -allow launch
    
       CUSTOM CONFIGURATION PERMISSIONS:
         CREATOR-OWNER -full
         Everyone -read
         System -full
         Interactive -full
    
    

  3. Select the Identity Tab, and then select "The Interactive User."

  4. Click OK two times.

On the DCOM CLIENT Win95 system:

  1. Using DCOMCNFG.EXE, select the Default Security Tab.

  2. Click Edit Default and then grant Access to "The World" user.

This will allow objects WithEvents to work across DCOM from Win95 to NT (and back).

STATUS

Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

As an alternative to using remote events, you can implement a callback to enable two-way communication between a DCOM client and server using Visual Basic 5.0.

For more information regarding callbacks, please see the following article in the Microsoft Knowledge Base:

      ARTICLE-ID: Q175510
      TITLE     : VB5DCOM.EXE: Using Callbacks and WithEvents with DCOM

Steps to Reproduce Behavior

DCOM Client Application (Standard Exe)

  1. Add the following code to the Declarations section of a standard form:

          Dim WithEvents MyServer as DCOMServer.EventClass
    

  2. Add a CommandButton to the form and add the following code to it:

          Private Sub Command1_Click()
    
             Set MyServer = New DCOMServer.EventClass
             Call MyServer.TimerTask(9.84)
          End Sub
    
          Private Sub MyServer_UpdateTime(ByVal dblJump As Double)
          Dim ServerTime as String
             ServerTime = Str(Format(dblJump, "0"))
             DoEvents
          End Sub
    
          Private Sub MyServer_Complete()
             Set MyServer = Nothing
          End Sub
    
    

  3. Close the client project and create the server project.

DCOM Server Application - DCOMServer

  1. Start a new ActiveX exe project and set the name to "DCOMServer."

  2. Add a class module and set the name property to EventClass.

  3. Add the following code to the Declarations section of the EventClass:

          Public Event UpdateTime(ByVal dblJump As Double)
          Public Event Complete()
    

  4. Add the following procedure to the EventClass class module:

          Public Sub TimerTask(ByVal Duration As Double)
          Dim dblStart As Double
          Dim dblSecond As Double
          Dim dblSoFar As Double
    

          dblStart = Timer
          dblSoFar = dblStart
          Do While Timer < dblStart + Duration
    
              If Timer - dblSoFar >= 1 Then
                   dblSoFar = dblSoFar + 1
                   RaiseEvent UpdateTime(Timer - dblStart)
              End If
          Loop
          RaiseEvent Complete
          End Sub
    
    

  5. Compile and close the server project.

  6. Reopen the client application and set a reference to the server "MyServer.EventClass" in Project References.

  7. Run the client project and click on Command1. Note that you receive "Error 70 Permission Denied" when the server executes the line "RaiseEvent UpdateTime(Timer - dblStart)" in the TimerTask procedure.

REFERENCES

VB5DCOM.exe file in the Microsoft SoftWare Library.

For additional information, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q171456
   TITLE     : PRB: Run-time error -2147023071 (80070721) using WithEvents


Additional query words: "Error 70"
Keywords : vb5all kbfaq
Technology : ole
Version : WINDOWS:5.0
Platform : Win95 WINDOWS
Issue type : kbprb


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 26, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.