|
-
Feb 10th, 2006, 05:18 PM
#1
Thread Starter
Junior Member
[RESOLVED] ActiveX server and DCOM
OK, I have quite a tangle.
I have created an ActiveX exe out-of-process server (the class is called Locator.Locator), which implements an interface I've invented and called ILocator. The Locator object currently has an instancing type of MultiUse (with 1 thread in its thread pool, if that makes a difference).
I have a Standard exe that accesses this server using a CreateObject call
VB Code:
Dim IL As ILocator
Set IL= CreateObject("Locator.Locator")
Even though this call is sometimes repeated several times during the course of the program's execution, it always connects to the same object, as long as something doesn't kill the ActiveX exe process.
That's what's happening when I'm running both on the same computer, which is exactly what we want to happen.
I want to run the server process on several machines in the network, with each of them communicating with each other, sharing information. The purpose behind this, by the way, is graceful failure, so that if any of them goes down, the rest of the networked computers can allow for this, and recover. Therefore I've put a function onto the ILocator interface whose implementation looks like this:
VB Code:
Private Sub ILocator_Connect(Machine As String)
Dim IL As ILocator
'Some code here to make sure Machine is a valid name
Set IL=CreateObject("Locator.Locator",Machine)
If Err Or IL Is Nothing Then
MsgBox "Could not connect to " & Machine & ": (" & Err & ") " & Err.Description, , "Connection Error"
Err.Clear
Exit Sub
End If
'Some code here to add IL to a collection for later access
End Sub
Ideally, this function would connect to the server process running on Machine, and return its ILocator interface. I would like it to behave exactly like all the other CreateObject calls, so that it won't create multiple copies of the server process.
Here's where I seem to start running into DCOM issues. Right now, my DCOM settings (on both computers) are set this way:
Default Authentication Level: None
Default Impersonation Leve: Anonymous
Default Security allows launch and access to Everyone, Interactive, and System
Locator.Locator settings:
Authentication Level: Default
Location: Run on this Computer
Security: Default Launch and Access
Identity: The launching user
When I set it up this way, the CreateObject call works properly as long as the same user is logged on to both computers. If different users are signed on, and the user on the other machine is already running the process server, I get a new copy of the process server. Once I looked into it, I found that this was expected behavior for Identity: the launching user, because the two processes belong to different people.
If I change the identity option to "The interactive user", which is supposed to use the security scope of the person logged on, the connect process causes the process to stop responding (apparently because it is getting no answer). And anyway, we don't want to use this option because you have to have somebody constantly logged on to the other computers in order to run using this option.
If I change the identity option to "This user:" and supply my own username and password, the Standard EXE can no longer correctly access the Locator on the same computer with it, even when I'm the one logged on (and I can't even try connecting to another computer, because my Locator object doesn't have a user interface--I need to get at the Connect function through my standard exe in order to even attempt connecting to the other computer). The error that I'm getting is extremely strange because, apparently, the CreateObject("Locator.Locator") call returns an (apparently) valid ILocator object (and doesn't throw an error), but any attempt to call the functions of the ILocator object causes error 462, "The remote server machine does not exist or is unavailable."
Does anyone out there have any insight into what I should change in the projects or the DCOM settings to make it possible to run an out-of-process server on several machines, some of which might have different users or not have anyone logged in, and have the processes communicate properly?
--roo2d2
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|