PRB: "Permission Denied" Using WithEvents and DCOM on WIN95 |
ID: Q179835
The information in this article applies to:
- Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, version 6.0
- Microsoft Visual Basic Control Creation, Learning, Professional, and Enterprise Editions for Windows, version 5.0, on platform(s):
- The Microsoft Windows operating system versions 95, 98
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 Windows NT server or Windows 2000 to communicate with a Windows 95 or Windows 98 client application is the following:
On the DCOM SERVER using DCOMCNFG.EXE:
- Select the server ProgID or GUID.
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
- Select the Identity Tab, and then select "The Interactive User."
- Click OK two times.
On the DCOM CLIENT Windows 95 or Windows 98 system:
- Using DCOMCNFG.EXE, select the Default Security Tab.
- 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)
Add the following code to the Declarations section of a standard form:
Dim WithEvents MyServer as DCOMServer.EventClass
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
- Close the client project and create the server project.
DCOM Server Application - DCOMServer
- Start a new ActiveX exe project and set the name to "DCOMServer."
- Add a class module and set the name property to EventClass.
Add the following code to the Declarations section of the EventClass:
Public Event UpdateTime(ByVal dblJump As Double) Public Event Complete()
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
- Compile and close the server project.
- Reopen the client application and set a reference to the server "MyServer.EventClass" in Project References.
- 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 : kbVBp600 kbGrpVBDB
Version : WINDOWS:5.0,6.0
Platform :
Issue type : kbprb
Technology :
Last Reviewed: October 2, 2000 |