470,591 Members | 2,253 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,591 developers. It's quick & easy.

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 4507
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Mark Broadbent | last post: by
2 posts views Thread by Mark Broadbent | last post: by
6 posts views Thread by Z D | last post: by
reply views Thread by Hankman | last post: by
4 posts views Thread by Rich | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.