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

ID: Q179835


The information in this article applies to:


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 Windows 95 or Windows 98 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 Windows 95 or Windows 98 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 Windows 95 or Windows 98 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:

Q175510 : 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:

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

Additional query words: "Error 70" kbVBp500 kbVBp kbWinOS98 kbDSupport kbVBp600 kbDCOM kbdse


Keywords          : 
Version           : WINDOWS:5.0,6.0
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: May 20, 1999