Hello All,
I want my clients to use my remoted object by means of interfaces. These
interfaces also ensure clean seperation between client and server.
The approach I know to instantiate a CAO is
RemotingConfiguration.RegisterActivatedClientType(
typeof(MyObject),
"tcp://localhost:1234/MyServer");
MyObject obj = new MyObject();
But I cannot do this because I am using an Interface for the client to
invoke the method on the server.
How to have an interface based client server coupling when using CAOs?
Thanks for your help in advance.
regards,
Abhishek. 5 1577
Hi Abhishek,
Check out the Activator.CreateInstance method. This method can be used to create the instance of CAO using interface.
Take a look at the following links,
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemactivatorclasscreateinstancetopic.asp>
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/introremoting.asp>
Hope this helps...
--
Regards,
Madhu
Microsoft C# MVP | MCSD.NET
"Abhishek Srivastava" wrote: Hello All,
I want my clients to use my remoted object by means of interfaces. These interfaces also ensure clean seperation between client and server.
The approach I know to instantiate a CAO is
RemotingConfiguration.RegisterActivatedClientType( typeof(MyObject), "tcp://localhost:1234/MyServer"); MyObject obj = new MyObject();
But I cannot do this because I am using an Interface for the client to invoke the method on the server.
How to have an interface based client server coupling when using CAOs?
Thanks for your help in advance.
regards, Abhishek.
I have already tried Activator.CreateInstance method. But it does not work.
The error message that will appear is
Unhandled Exception: System.MemberAccessException: Cannot create an
instance of an interface.
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at Client.Main(String[] args)
I am not providing the implementation of the remote object to the
client. The client binds only to the interface being implemented by the
remote object.
I found a solution which involves using soapsuds. However it works only
for the http channel whereas I want to use tcp channel.
regards,
Abhishek.
Madhu[C#-MVP] wrote: Hi Abhishek,
Check out the Activator.CreateInstance method. This method can be used to create the instance of CAO using interface.
Take a look at the following links,
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemactivatorclasscreateinstancetopic.asp>
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/introremoting.asp>
Hope this helps...
Hi,
can you post your CreateInstance line?
Also, you do not have to call RegisterActivatedClientType before that.
Sunny
In article <O3*************@TK2MSFTNGP10.phx.gbl>, abhishek- sr********@nospam.net says... I have already tried Activator.CreateInstance method. But it does not work.
The error message that will appear is
Unhandled Exception: System.MemberAccessException: Cannot create an instance of an interface. at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at Client.Main(String[] args)
I am not providing the implementation of the remote object to the client. The client binds only to the interface being implemented by the remote object.
I found a solution which involves using soapsuds. However it works only for the http channel whereas I want to use tcp channel.
regards, Abhishek.
Madhu[C#-MVP] wrote: Hi Abhishek,
Check out the Activator.CreateInstance method. This method can be used to create the instance of CAO using interface.
Take a look at the following links,
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemactivatorclasscreateinstancetopic.asp>
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/introremoting.asp>
Hope this helps...
Abhishek,
You should call the version of CreateInstance which takes an array of
objects to use as activation attributes. The attribute that you will want
to pass is an instance of UrlAttribute, which specifies where the object
will be activated. Then, you have to unwrap the ObjectHandle that is
returned, and then cast that to the interface.
There is an example in the documentation for CreateInstance.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Abhishek Srivastava" <ab*****************@nospam.net> wrote in message
news:O3*************@TK2MSFTNGP10.phx.gbl... I have already tried Activator.CreateInstance method. But it does not
work. The error message that will appear is
Unhandled Exception: System.MemberAccessException: Cannot create an instance of an interface. at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at Client.Main(String[] args)
I am not providing the implementation of the remote object to the client. The client binds only to the interface being implemented by the remote object.
I found a solution which involves using soapsuds. However it works only for the http channel whereas I want to use tcp channel.
regards, Abhishek.
Madhu[C#-MVP] wrote: Hi Abhishek,
Check out the Activator.CreateInstance method. This method can be used
to create the instance of CAO using interface. Take a look at the following links,
<http://msdn.microsoft.com/library/de...-us/cpref/html
/frlrfsystemactivatorclasscreateinstancetopic.asp>
<http://msdn.microsoft.com/library/de...-us/dndotnet/h
tml/introremoting.asp> Hope this helps...
there are many ways to do this. Check out my article here on a better
way of creating your CAO. http://www.glacialcomponents.com/Art...cleID=CAOGuide
Allen Anderson http://www.glacialcomponents.com
mailto: allen@put my website url here.com
On Tue, 22 Jun 2004 12:26:56 +0530, Abhishek Srivastava
<ab*****************@nospam.net> wrote: Hello All,
I want my clients to use my remoted object by means of interfaces. These interfaces also ensure clean seperation between client and server.
The approach I know to instantiate a CAO is
RemotingConfiguration.RegisterActivatedClientType ( typeof(MyObject), "tcp://localhost:1234/MyServer"); MyObject obj = new MyObject();
But I cannot do this because I am using an Interface for the client to invoke the method on the server.
How to have an interface based client server coupling when using CAOs?
Thanks for your help in advance.
regards, Abhishek. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Matt Eberts |
last post by:
Sorry, bad title. Anyway, is there a way to pass the arguments to an object
instantiated via a constructor using the arguments object and have it
expanded, so to speak, so that it doesn't appear as...
|
by: pesso |
last post by:
I have an array of filenames, which are paths to the .NET assembly DLLs I
built. I know for sure that these assemblies have public method, Execute().
In the run-time, I want to be able to...
|
by: Chris Kiechel |
last post by:
I am writing a .NET Windows application and it needs to
perform DDE calls to a legacy system. I created a C++
unmanaged class that performs the actual DDE connection
and communication. However,...
|
by: Tom |
last post by:
I have a VB.NET framework 1.1 application that I am installing on my user's
workstation. It works fine on EVERY machine except for one - on this one
machine it generates a 'Overflow or underflow in...
|
by: Nagesh |
last post by:
hi,
I have seen the winvnc(tightvnc server) source code in this I seen
that class member funtions are calling without instantiating the object
i.e. like vncService::ShowDefaultProperties() where...
|
by: Anders Borum |
last post by:
Hello!
Whilst refactoring an application, I was looking at optimizing a
ModelFactory with generics. Unfortunately, the business objects created by
the ModelFactory doesn't provide public...
|
by: RB |
last post by:
Hi guys (and gals!),
I've got 2 classes, "TypesafeConstant" and "Color". "Color" inherits
from "TypesafeConstant", and adds no new functionality. All "Color" does
is to instantiate some class...
|
by: dascandy |
last post by:
Hi,
For a project I'm working on I'm kind-of-hacking my way around
deriving a class from an interface or such to create a mock, but
instead creating the mock directly. It is usable as the...
|
by: =?ISO-8859-1?Q?Marcel_M=FCller?= |
last post by:
Is the following code valid?
#include <stdlib.h>
#include <ostream.h>
// compare *l to *r
template <class T>
int comparer(const T* l, const T* r)
{ if (*l < *r)
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |