EnterpriseServices and multiple COM+ Servers

EnterpriseServices and multiple COM+ Servers

Old forum URL: forums.lhotka.net/forums/t/1966.aspx


Gareth posted on Wednesday, December 13, 2006

I'm currently working on implementing a solution involving CSLA using the Enterprise Services portal methods. It all works ok apart from the fact that in my environment we have several potential COM+/Enterprise Servers that can be selected to be used by the client application and I can't see a way to get the client to use a specific server.

For example, we have four servers, DEV, UAT, Production and DR (disaster recovery). They all run their own instance of the CSLA libraries and the COM+/EnterpriseService host DLL. They all have their own databases connections. In fact they are all identical in everyway except for the hostname.

On my client application I have a login screen with a dropdown list allowing the user to select which server (DEV,UAT,Prod or DR) they want to use (usually PROD). But I currently can't see a way to incorporate this into the client side of the DataPortal code as there is no way to specify a server name as its all handled behind the scenes by DCOM.

Does anyone have any ideas about how I might go about doing this?

So far I've potentially thought about creating a remoting interface to the COM+ server objects and then using the Remoting classes on the client side adapted for binary TCP. Is this a feasible solution?

Note that the server objects have to be hosted in COM+/Enterprise Services so that part can't be changed.

Thanks,
Gareth.


twistedstream replied on Wednesday, December 13, 2006

Assuming you're using CSLA.NET 2.0, you need to read the Enterprise Services section of Chapter 12 (Implementing Remote Data Portal Hosts) in the book, pages 612 - 619.

~pete

Gareth replied on Wednesday, December 13, 2006

Thanks, but I have the book and I have read that chapter. Unfortunately it only documents communicating to one COM+ server. There is no way in CSLA.NET to communicate with multiple COM+ servers using the EnterpriseServiceHost because you cannot specify a hostname at the client, it is all wrapped in the .msi installer so that connecting to a the COM+ server is transparent. I need to be able to specify a specific server at runtime.

twistedstream replied on Wednesday, December 13, 2006

Sorry, I misread the details of your original post.  You can set the host name of the remote server manually in Component Services by editing the Remote Server Name field of the Activation tab of the properties diaglog of the COM+ proxy application on the client machine. 

However, it sounds like you need to be able to do this programatically.  I don't think you can do that via the .NET Framework directly.  However, it can be done using the COM+ Administration Library, which is a COM library.  So you'll have to do a little COM Interop.

~pete

RockfordLhotka replied on Wednesday, December 13, 2006

There's a lower level API in .NET you can use to create an instance of a COM object on a specfic server. I don't recall the name of the API - but I found it once upon a time by running ildasm against some code I wrote that used the VB CreateObject() method. That method is compatible with the old VB6 CreateObject() method, that accepts a server name parameter - and the CIL behind the scenes should reveal the code you need to write to emulate that behavior.

My guess is that you could create a different enterprise services proxy object that used this technique, reading the server name from your app.config file.

Jimbo replied on Thursday, January 18, 2007

Com+ with mobile objects was never meant to be ( despite the best efforts of Rocky)
You could however develop a tcp remoting service/s - as intimated, but not expanded apon in The Book.



Copyright (c) Marimer LLC