Re: Server-to-Server Remoting

From: Jon Lipp (jon.lipp_at_acs-inc.com)
Date: 04/27/04


Date: Tue, 27 Apr 2004 07:46:12 -0700

I am wanting to do nearly the same thing that Bob is trying above. My
scenario is that I must connect to my database using a COM object that is
not thread-safe. Therefore, I can only use one database connection per
remoting service process. I am going to use thread synchronization to
ensure that only one thread per process can access the COM object.

So in order to support many many clients, my idea was to have a "router"
service that would multi-thread and to which the clients would connect.
This "router" would keep track of multiple "database" services running and
determine who was free. It would then connect to the free service and
submit the request. Which in our case consists of simple objects passing
back and forth containing the data. Therefore: Client A connects to
"router" service B, which in turn connects to "database" service C.

So Allen, I am curious about your statement "you can't middleman an object".
And also how you said in the last paragraph "to get around the problem..."
Can you elaborate?

thanks!!
Jon

"Allen Anderson" <allen@sparkysystems.com> wrote in message
news:s0gt70pbcsvbcje8vhc5jm6gf3vajteaq6@4ax.com...
> Your asking a lot of questions here so let me put down some general
> notes based on what I've seen looking through your sample and
> comments. You can't send an object from server b that you got at
> server a and send it to client c. In other words, you can't middleman
> an object.
>
> the register channel code to get from server a to server b is
> unncessary as your making a client call and there is already a channel
> registered for the application because its serving another object.
>
> your code that connects to server b from server a will be identical
> except for the channel registrations.
>
> to get around the problem with the type already being known locally,
> stop using configuration files. I realize that most people recommend
> using configuration files for everything, but this is a good time not
> to. If you simply have your abstract class available and use
> activator to get the type that YOU want to create at any given time,
> then you will know that your are getting the type you want based on
> the URI you use with activator.
>
> Allen Anderson
> http://www.glacialcomponents.com
> mailto: allen@put my website url here.com
>
>
> On 15 Apr 2004 02:12:00 -0700, bob@digitalmediums.com (Bob Pulgino)
> wrote:
>
> >Here's my situation:
> >
> >I have a classic client/server application that involves multiple
> >users of a WinForms application connecting to a central remoted .NET
> >component for business logic and database services. This has been
> >working fine for a few months now. In fact, it is in production for
> >two organizations; each organization has its own group of WinForms-app
> >users and a unique server with the .NET component running to provide
> >the users within that organization with services for the
> >organization's unique database.
> >
> >I am trying to implement a new feature for the next release of this
> >system that requires the ability to pass information from one
> >organization's service component to another's; i.e., I need to be able
> >to call a method on one specific instance of my remoted .NET component
> >(for organization "A") from within another method of a different
> >instance (server) of that same component (for organization "B").
> >
> >My problem is that I can't figure out how to register and instantiate
> >the proxy for the remote component class from within the local
> >instance of the same class - when I use the same code I used to
> >connect from the WinForm application, the framework throws an "Unknown
> >remoting error" exception the first time I reference the proxy.
> >
> >Here are the implementation details: I define an abstract base class
> >called BaseDataService that is used by the client as the interface for
> >the service component, which is a subclass of BaseDataService called
> >MaxDataService.
> >
> >Here is the code I use in the console app that hosts the service
> >component:
> >
> > RemotingConfiguration.Configure("MaxDataServiceConsole.exe.config")
> >
> >(...from MaxDataServiceConsole.exe.config:)
> > <channels>
> > <channel ref="http" port="1234">
> > <serverProviders>
> > <formatter ref="binary" />
> > </serverProviders>
> > </channel>
> > </channels>
> > <service>
> > <wellknown
> > mode="Singleton"
> > type="DataServices.MaxDataService, MaxDataService"
> > objectUri="MaxDataService.rem"
> > />
> > </service>
> >
> >
> >Here is the code I used to connect to the service component from
> >within the WinForms app:
> >
> > Private Shared mDataService As BaseDataService
> > ...
> > Dim channel As HttpChannel
> > channel = New HttpChannel(Nothing, New
> >BinaryClientFormatterSinkProvider(), Nothing)
> > ChannelServices.RegisterChannel(channel)
> > Dim serviceUrl as String =
> >"http://localhost:1234/MaxDataService.rem"
> > mDataService = CType(Activator.GetObject(GetType(BaseDataService),
> >serviceUrl), BaseDataService)
> >
> >
> >As I said above, this all works fine... the problem arose when I added
> >a method to the MaxDataService component that used the following code:
> >
> > ' Get the URL to the vendor's service component
> >[1] Dim mdsURL As String =
> >Me.GetDataServiceURL(soldevent.VendorMemberID)
> >
> > ' Obtain connection to the vendor's service component...
> >[2] Dim mds As MaxDataService = CType(Activator.GetObject( _
> > GetType(MaxDataService), mdsURL), MaxDataService)
> >
> > ' Test the connection...
> >[3] Dim test As String = mds.Greetings
> >
> >
> >Tracing through this code, I know that we have a valid URL after line
> >[1], and we have a non-null value for 'mds' after line [2] (mds has a
> >value of type transparentProxy), but when we try to invoke the simple
> >test member named Greetings in line [3], the "unknown remoting error"
> >exception is thrown.
> >
> >
> >Originally, I used the two lines of code shown below right above line
> >[2]:
> >
> > Dim channel As HttpChannel = New HttpChannel(Nothing, New
> >BinaryClientFormatterSinkProvider(), Nothing)
> > ChannelServices.RegisterChannel(channel)
> >
> >...but I had to remove them because the RegisterChannel call threw an
> >exception stating that the channel was already registered.
> >
> >
> >Just out of curiosity, I tried the line of code shown below instead of
> >line [2] to see what would happen:
> >
> >
RemotingConfiguration.RegisterWellKnownClientType(GetType(MaxDataService),
> >mdsURL)
> >
> >...but this line threw an exception with the following message:
> >
> >Attempt to redirect activation for type 'DataServices.MaxDataService,
> >MaxDataService'. This is not allowed since either a well-known
> >service type has already been registered with that type or that type
> >has been registered has a activated service type.
> >
> >I'm assuming my problem is that I'm trying to register a given type as
> >a remoted type when that type is already known locally (?), but I
> >can't believe that I'm the only one who ever wanted to do such a thing
> >- there has to be a way to connect two components of the same type
> >through .NET remoting (I hope?).
> >
> >Can anyone help?
>



Relevant Pages

  • Re: Help with first VB application - Data Entry form
    ... I assumed a desktop / winform client application ... time' stamp from the database machine - control machine ... ... problem solved - web server is control system. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Help with first VB application - Data Entry form
    ... I assumed a desktop / winform client application ... time' stamp from the database machine - control machine ... ... problem solved - web server is control system. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Remobjects v KBM
    ... >> client query components) follow from that. ... Then, connections can be created to say SQL Server, Oracle, Interbase and ... can then be created from the abstract dataset definition in 'customers' to ... implicitly - this makes your code not be database connection specific). ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: Help with first VB application - Data Entry form
    ... stamp from the database machine - control machine ... ... unnecessary data to the client ... ... and when building a database independent UI / Client - Server application, ... JavaScript, for example) and thus, will get the time from the web server, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Opinions needed about the best "Middleware suite" kbmMW vs. RODA
    ... kbmMW supports cross db in such way that all you need to do in your application is to set one property to switch to ... What one have to concentrate about is minimizing the amount of data moved from the app server to the client. ... C/S setup's usually have a quite active chatter going on between the client and the database, ...
    (borland.public.delphi.thirdpartytools.general)

Loading