473,466 Members | 1,416 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problem in .NET Remoting with Client Activated Objects(CAO)

Hi;
I'm doing an example program from a book regarding .NET Remoting.
Both the Client and Server are C# Console Applications.

Server Code is

using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
namespace Wrox.Samples
{
class SimpleServer
{
[STAThread]
static void Main(string[] args)
{
//Create and register the Server Channel
TcpServerChannel channel=new TcpServerChannel(9000);
ChannelServices.RegisterChannel(channel);

RemotingConfiguration.ApplicationName="SimpleServe r";

ActivatedServiceTypeEntry remObj=new
ActivatedServiceTypeEntry(typeof(MyRemoteObject));
RemotingConfiguration.RegisterActivatedServiceType (remObj);
Console.WriteLine("Press Return To Exit");
Console.ReadLine();

}
}
}

And the Remote Object Class in the Wrox.Samples Project is
using System;

namespace Wrox.Samples
{
public class MyRemoteObject:System.MarshalByRefObject
{
public MyRemoteObject()
{
Console.WriteLine("Constructor Called");
}

public string Hello()
{
Console.WriteLine("Hello Called");
return "Hello, .NET Client!";
}
}
}
And my Client Code is

using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using Wrox.Samples;
using System.Runtime.Remoting.Activation;

namespace WS
{
class SimpleClient
{
[STAThread]
static void Main(string[] args)
{
//Create and Register the Client Channel
TcpClientChannel channel=new TcpClientChannel();
ChannelServices.RegisterChannel(channel);

ActivatedClientTypeEntry entry=new
ActivatedClientTypeEntry(typeof(MyRemoteObject),"t cp://localhost:9000/");
RemotingConfiguration.RegisterActivatedClientType( entry);

MyRemoteObject obj=new MyRemoteObject();//###Exception Occures
here

for (int i=0; i<5; i++)
{
Console.WriteLine(obj.Hello());
} Console.ReadLine();
}
}
}

My Problem is When I Run the Server and the Client in the Client where
I'm Instantiating the New MyRemoteObject the Following Error Comes.
An unhandled exception of type
'System.Runtime.Remoting.RemotingException' occurred in mscorlib.dll

Additional information: Permission denied for activating type
Wrox.Samples.MyRemoteObject, MyRemoteObject, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null.

But for WellKnown and Singleton RemoteObjects it Works Fine.
The error Comes only for CAO Scenario.

Help regarding this problem is highly appreciated.

Thanks
Deepal
Nov 15 '05 #1
3 4681
Hi Deepal,

Are you presently using a soapsuds.exe generated proxy
reference on the client side for 'MyRemoteObject' .
I think there is an issue with soapsuds generated
proxies for this particular case with CAO objects. Can you try referencing
the same server side assembly that contains 'MyRemoteObject' in
the client side and see if the issue goes away

Regards,
Aravind C
"Deepal" <de*****@sabretch.com> wrote in message
news:ed**************************@posting.google.c om...
Hi;
I'm doing an example program from a book regarding .NET Remoting.
Both the Client and Server are C# Console Applications.

Server Code is

using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
namespace Wrox.Samples
{
class SimpleServer
{
[STAThread]
static void Main(string[] args)
{
//Create and register the Server Channel
TcpServerChannel channel=new TcpServerChannel(9000);
ChannelServices.RegisterChannel(channel);

RemotingConfiguration.ApplicationName="SimpleServe r";

ActivatedServiceTypeEntry remObj=new
ActivatedServiceTypeEntry(typeof(MyRemoteObject));
RemotingConfiguration.RegisterActivatedServiceType (remObj);
Console.WriteLine("Press Return To Exit");
Console.ReadLine();

}
}
}

And the Remote Object Class in the Wrox.Samples Project is
using System;

namespace Wrox.Samples
{
public class MyRemoteObject:System.MarshalByRefObject
{
public MyRemoteObject()
{
Console.WriteLine("Constructor Called");
}

public string Hello()
{
Console.WriteLine("Hello Called");
return "Hello, .NET Client!";
}
}
}
And my Client Code is

using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using Wrox.Samples;
using System.Runtime.Remoting.Activation;

namespace WS
{
class SimpleClient
{
[STAThread]
static void Main(string[] args)
{
//Create and Register the Client Channel
TcpClientChannel channel=new TcpClientChannel();
ChannelServices.RegisterChannel(channel);

ActivatedClientTypeEntry entry=new
ActivatedClientTypeEntry(typeof(MyRemoteObject),"t cp://localhost:9000/");
RemotingConfiguration.RegisterActivatedClientType( entry);

MyRemoteObject obj=new MyRemoteObject();//###Exception Occures
here

for (int i=0; i<5; i++)
{
Console.WriteLine(obj.Hello());
} Console.ReadLine();
}
}
}

My Problem is When I Run the Server and the Client in the Client where
I'm Instantiating the New MyRemoteObject the Following Error Comes.
An unhandled exception of type
'System.Runtime.Remoting.RemotingException' occurred in mscorlib.dll

Additional information: Permission denied for activating type
Wrox.Samples.MyRemoteObject, MyRemoteObject, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null.

But for WellKnown and Singleton RemoteObjects it Works Fine.
The error Comes only for CAO Scenario.

Help regarding this problem is highly appreciated.

Thanks
Deepal

Nov 15 '05 #2


Hi Aravind,
What i have done is i Compiled the MyRemoteObject.cs into a
MyRemoteObject.dll in the Command Prompt

csc /target:library /out:MyRemoteObject.dll MyRemoteObject.cs

Then In the Client Project I added the Project reference to
MyRemoteObject.dll.

That's all i did.

What's wrong in that? Is there anything that i have missed or something
to do with soapsuds?
Thanks
Deepal

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #3
Hi Deepal,

Actually, I originally assumed that the client's project had
a reference to MyRemoteObject.dll that was generated using soapsuds.exe.
But now since you are referencing the same assembly (and not using the
soapsuds generated one), I think you could disregard my earlier post.
I will check and let you know.

Regards,
Aravind C
"Deepal Kanchana" <de*****@sabretch.com> wrote in message
news:OV**************@TK2MSFTNGP10.phx.gbl...


Hi Aravind,
What i have done is i Compiled the MyRemoteObject.cs into a
MyRemoteObject.dll in the Command Prompt

csc /target:library /out:MyRemoteObject.dll MyRemoteObject.cs

Then In the Client Project I added the Project reference to
MyRemoteObject.dll.

That's all i did.

What's wrong in that? Is there anything that i have missed or something
to do with soapsuds?
Thanks
Deepal

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Deepal | last post by:
Hi; I'm doing an example program from a book regarding .NET Remoting. Both the Client and Server are C# Console Applications. Server Code is using System; using System.Runtime.Remoting;...
5
by: Mark Broadbent | last post by:
Could someone clear this up for me a bit. I am a little bit uncertain about this but this is my understanding. Please correct where wrong or bits missing. There are two types of remoting :- ...
2
by: Mark Broadbent | last post by:
Could someone clear this up for me a bit. I am a little bit uncertain about this but this is my understanding. Please correct where wrong or bits missing. There are two types of remoting :- ...
6
by: Z D | last post by:
Hello, Is it true that I need to push the DLL for my entire class if I wish to use CAO remoting??? Can't I just use an Interface to the class on the client side and instantiate the object in...
0
by: Hankman | last post by:
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...
4
by: Rich | last post by:
Can anyone suggest a good (current) tutorial on how to do basic remoting with C# (2005 express edition)?
1
by: Dave Evans | last post by:
I have a number of remotable DLLs, which are hosted by a Windows Service. The Windows Service simply registers the remotable DLLs using RemotingConfiguration.Configure. The configuration file is as...
1
by: chandu | last post by:
any body give exact explanation on how CAO and SAO can be used in remoting application
0
by: abhijit4229 | last post by:
Hello, I have strange situation on hand , I have remotely exposed an object through Windows serice. I am using Client Activated Objects(CAO) . Now whenever I try to create an proxy object...
0
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.