CAO

dotnet framework

    Sponsored Links

    Next

  • 1. globalization of remote objects?
    I have a the following problem: In a client/server application clients must be able to run in different languages (culture's). situation: The resourcestrings are located on the server. The server is accross the application boundaries; the client(s) use a remote object to translate the strings. what goes wrong: When 2 clients use different culture's the Thread.Currenthread.CultureUICulture and CurrentCulture (on the server) are set to whatever the settings are on the last started client. So client 1 gets a the string in a wrong language. what doesnt work: I cannot use the overloaded function getstring from the resourcemanager (with the culture as extra parameter) since we use third party components which dont have these overloaded functions. I cannot set the Thread.Currenthread.CultureUICulture and CurrentCulture on the server every time i do something on the client. Not only is it not good for performance, but more important: it is possible that before the server provides an answer, client2 could have set a different culture. Does anyone have a solution for the problem? What is the best way to handle this (threadpool?!)? Anyone has an example somewhere? Thanks in advance
  • 2. Performance Monitoring: Context Proxies
    After monitoring my remoting application with Performance Monitor, I've noticed that the count on the ContextProxies counter is only going up. Every call increments this number and it will never go down. Does anyone know if the ContextProxies counter simply adds new proxies created, or is this telling me that my app is not letting go of a remote object. Thanx in advance.
  • 3. Problem with Ingo's EventsEnhanced sample
    Hi, I have downloaded Ingo's EventsEnhanced sample and did the following modification: In General.cs: 1. Add a serializable class: [Serializable] public class MyClass { public string _str; public string MyString{get { return _str;} set {_str=value;}} string _private; public string ReadOnly{get {return _str;}} } 2. Modified the delegate to: public delegate void MessageArrivedHandler(String msg,MyClass oClass); In Server.cs: Modified SafeInvokeEvent to print out MyClass.MyString. I have no problem to run the modified samples on my Windows 2003 Server box. However, after I add the strong name for General.dll (I haven't put it in GAC and didn't change any configuation files either), I ran server.exe, no problem. Then ran EventListener.exe, no problem. Then ran EventInitiator.exe, no problem with itself, but the server.exe console showed "Number of Listeners: 1. Exception occured, will remove Delegate. Because of security restrictions, the type General.MyClass cannot be accessed. InnerErr: Request failed." I modified his code to print out error message and inner error message. Anybody has idea why? Thanks in advance!!! Cindy
  • 4. Newbie: Server -> Hosting application feedback
    Hi I want my remoting server object to be able to provide feedback to the Win Forms based task tray application that is hosting it. When a client executes a method on the server, I want the server to notify it's host application so it, in turn, can then display information in a pop-up window. I don't want the pop-up window to be included in the server object implementation. I'm new to remoting and can't figure out how to provide feedback from the remoting server object instance to it's host app. I suspect I'm missing something obvious here! Ideally, I'd like to provide an event in the server object class that the host app then subscribes to to receive notifications. Thanks in advance Ben

CAO

Postby Amit » Wed, 03 Nov 2004 21:23:30 GMT

hi people

i am using CAO...
following is the code in the client:
TcpChannel channel = new TcpChannel()
			ChannelServices.RegisterChannel(channel)

RemotingConfiguration.RegisterActivatedClientType
				typeof(MyRemoteObject)
				"tcp://localhost:1234/AppName")

however i am getting the following error:::::::::

Does anyone has sample where i can explore CAO :::::::

An unhandled exception of type 'System.Runtime.Remoting.RemotingException' occurred in mscorlib.dl

Additional information: Permission denied for activating type soap:MyRemoteObject,  http://www.**--****.com/ %2C%20Version%3D1.0.1767.28795%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull



---
Posted using Wimdows.net Newsgroups -  http://www.**--****.com/ 

Re: CAO

Postby Sam Santiago » Thu, 04 Nov 2004 01:05:33 GMT

Try some code like this on the client side:

Dim clientProv As BinaryClientFormatterSinkProvider
Dim serverProv As BinaryServerFormatterSinkProvider = New
BinaryServerFormatterSinkProvider
serverProv.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full
clientProv = New BinaryClientFormatterSinkProvider
Dim props As IDictionary = New Hashtable
props("port") = 0
Dim chan As TcpChannel = New TcpChannel(props, clientProv, serverProv)
ChannelServices.RegisterChannel(chan)

Also, check out this link for an example with CAOs:

Implementing Broker with .NET Remoting Using Client-Activated Objects
 http://www.**--****.com/ 

Thanks,

Sam

-- 
_______________________________
Sam Santiago
 XXXX@XXXXX.COM 
 http://www.**--****.com/ 
_______________________________




occurred in mscorlib.dll
soap:MyRemoteObject,
 http://www.**--****.com/ %2C%20Version%3D1.0.1767.28795%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull.



Re: CAO

Postby Amit » Thu, 04 Nov 2004 20:44:15 GMT

thanks for ur reply ...

i tried that code

but still i am getting that error..

my client code is 

BinaryClientFormatterSinkProvider  clientProv
			BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider()
			serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full
			clientProv = new BinaryClientFormatterSinkProvider()

			Hashtable props = new Hashtable()
			props["port"] = 0
		
			TcpChannel channel = new TcpChannel(props,clientProv, serverProv)
			ChannelServices.RegisterChannel(channel)

	
		RemotingConfiguration.RegisterActivatedClientType
				typeof(MySingletonFactory)
				"tcp://localhost:1234/CAO_PacLife_App")

AND SERVER CODE IS

TcpChannel chnl = new TcpChannel(1234)
			ChannelServices.RegisterChannel(chnl)

			//For CAO. Begi
			RemotingConfiguration.ApplicationName = "CAO_PacLife_App"
			RemotingConfiguration.RegisterActivatedServiceType(typeof(MySingletonFactory));

---
Posted using Wimdows.net Newsgroups -  http://www.**--****.com/ 

Re: CAO

Postby Sam Santiago » Thu, 04 Nov 2004 23:03:11 GMT

The concepts that apply to the client side also apply to the server side, so
just apply them.

-- 
_______________________________
Sam Santiago
 XXXX@XXXXX.COM 
 http://www.**--****.com/ 
_______________________________




BinaryServerFormatterSinkProvider();
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
RemotingConfiguration.RegisterActivatedServiceType(typeof(MySingletonFactory
));



Re: CAO

Postby Amit » Fri, 05 Nov 2004 19:17:54 GMT

actually there is bug in 1.1 framework
it got solved my downloading the patch from sit



---
Posted using Wimdows.net Newsgroups -  http://www.**--****.com/ 

Similar Threads:

1.How to access a CAO serverside, or - how to achieve CAO functionalities with a Singleton

Hello,

I'm trying to design a remoting architecture with the following requirements :
*** An object for each client instance ; that is, not only having ClientA and ClientB point to different objects, but also, for a given client, having 2 different ObjectA_1 and ObjectA_2 to proxy to a different server MBR. I know the first part is feasible with CAO, I don't know for the second one.

*** My server-side code is going to look like :
void DoSomething(string myArgs)
{
	// Fire an Event
	OnDoSomething(myArgs);
}
because I don't know what the implementation will be like : the user will do it himself.
He therefore needs to be able to add an event handler to the server object (the event handler is exclusively server-side I repeat - the client-side Dll uses an eventless interface).


- I tried to do this with CAO, but the 2nd clause was the problem : how can I add an event handler to a CAO when I don't know where the CAO is located server-side ? I tried to seek a way of getting a signal that a client had just created a proxy, but alas so far I had no such luck.
- I then tried to do it with a Singleton, but the 1st clause was the problem : how can I keep a separate state for each client with that ? I thought of using a Hashtable where the key would be the client Ip (I'd have to create a custom server sink), but that wouldn't work with the requirement of having multiple client objects point to multiple server objects. Besides, how would I go on to maintain the object changes in the Hashtable - that is, what would be the *value* in the Hash ?


At the moment I'm completely stuck on the CAO approach, can't figure out a way to do something that doesn't seem heavy as hell with the Singleton approach - in short I'm about to stop MBR and go brute force with MBV ... I'd hate to have to that, so if anyone can give some light on this problem, I'd appreciate it *a lot*.
Thanks in advance !

2.Remote CAO Error

Hello,

I'm having a problem with a remoting CAO. The CAO creates an instance of a
VB6.0 ActiveX.exe which talks to an old application though DDE. Everything
works fine when the client is a Winforms or console app. Then I try to make
an ASP.NET web page the client it fails. At first It would not create the
instance because of security, but I added the ASPNET to the Admin of the
machine and added full trust to the assembly, now it creates it. I also have
the AspCompat="true" in the page header. The error I get from the
ActiveX.exe is "foriegn app failed to respond to DDE Initiate." It appears
that the ASPnet workerprocess is not allowing the DDE conversation. I also
notice that when I shut down VisualStudio, the worker thread is still
running along with the ActiveX.exe. When I run it from one of the other
clients everything shuts down when the client closes.

I am using VS.NET 2002 Frame 1.0

Any Idea's??

Thanks

Hank


3.difficult CAO remoting problem with NAT router

please don't answer this without reading the entire message.  I'm not
asking about machinename.

I am trying to figure out a way to have my remoting system deal with
being behind a firewall, a NAT router or other various network
devices.

the problem is that when using a CAO will force the server to send
back the 'address' to the client.  Because the people using this
particular product may not be very computer savvy,, I can't rely on
them entering an external IP (for that matter they may be behind a
dynamic IP so they would have to enter it every time which is
untenable).

what I need to know, is how exactly do I intercept where the server is
sending back the 'unique address' to the client so I can put the IP
that the CLIENT sees the server as, not what the SERVER sees itself
as?

machinename isn't a workable solution as most NAT routers available
these days won't re-route the IP from internal back to internal if the
external address is machinenamed in.  Also, machinename isn't workable
for the entry reasons stated above.  I need to intercept the call and
change the address sent back to the client on the fly.


4.Creating a CAO with Multiple Network Interfaces / Subnets

I have an application (C#, but I don't think that matters) using the
in which I'm using Activator.CreateInstance (Type, Object[], Object[])
to create a Client Activated Object. It works perfectly when the
client and server are both on machines with only one network interface
enabled and on the same subnet, but I'm working on an upgrade which
will require the client to have two active NICs, and be able to fetch
the remote object from a server on either NIC (or both).  I thought
since the third argument to CreateInstance is the URL of the remote
object server, it would be able to determine the appropriate network
interface to use, but the method call throws a
TargetInvocationException after a significant delay (a network error
timeout).  I'm running a packet sniffer called EtherPeek, and I can
see that no network traffic is going out on either NIC when the remote
object request is made, so it looks like the framework is just plain
confused, and can't determine which NIC on which to send the request.
(I would expect to at least see the request go out over the network,
and then have a timeout occur when no response was fired back.)

The server publishes the object using SOAP on an HttpChannel,
"useIpAddress" is set to false, and the "machineName" is set to the
Server's IP address.  (I had found many suggestions about doing this
to create a CAO through a router to a different subnet - a slightly
different situation than what's going on here.)  I can connect to both
networks with no problems, so networking is properly configured. I can
even use my web browser to see the URI, so it is properly published on
the Server.

The opposite setup (one server publishing a remote object on multiple
NICs) is easy and works fine, but I can't get this setup to work at
all. Has anyone ever seen a situation like this before, and if so,
figured out how to convince .NET to send the request out the right
interface?

Thanks much,
Andy

5.Creating a CAO instance in the same application where it is hosted

Hi,

I have a CAO component which is hosted by my server. This server also 
contains function, in which i need to create an instance of this CAO. 
(This CAO object has to be passed to another process)

When I first tried to create CAO component using overloaded 
Activator.CreateInstance() method with activationAttributes that has URL 
properties, I got the following exception:

"Invalid Internal State: MarshalByRefObject should not have proxy object in 
the same AppDomain"

To overcome this, I created a new AppDomain and used CreateInstance function 
of AppDomain to create an instance of the CAO.

This function returns an reference of type ObjectHandle. When I try to 
typecast it to the CAO component type i am getting "InvalidCastException".

If I use, ObjHandle.UnWrap() the instance is no longer behaving like a 
proxy. It is a local component and i cannot pass it to another process.

Even if i send ObjHandle to another process, once it unwraps objHandle it 
becomes a local instance which it cannot use.

Is there any other way i can over come this.

Any Suggestion or input on this will help me a lot

Regards
Hari 

6. CAO destructor ?

7. CAO and scalability

8. CAO 3 tier model



Return to dotnet framework

 

Who is online

Users browsing this forum: No registered users and 86 guest