Groups | Blog | Home
all groups > dotnet remoting > november 2003 >

dotnet remoting : Because of security restrictions, the type System.Runtime.Remoting.ObjRef cannot be accessed


Sunny
11/25/2003 3:17:18 PM
Hi Pavel,
please, read this:
http://www.ingorammer.com/RemotingFAQ/Changes2003.html

Hope that helps
Sunny

In article <#stDEf2sDHA.1060@TK2MSFTNGP12.phx.gbl>, pgusak@ukr.net
says...
[quoted text, click to view]
Pavel Gusak
11/25/2003 5:20:59 PM
I'm trying to use Remoting to receive notifications from another .NET
component.
I'm successfully accessing remoted object (created by the server app), but
can not pass a reference to my object as a "callback".

I get the following error message:

An unhandled exception of type
'System.Runtime.Serialization.SerializationException' occurred in
mscorlib.dll

Additional information: Because of security restrictions, the type
System.Runtime.Remoting.ObjRef cannot be accessed.

Here is my sources:

// event target interface
public interface EventTarget
{
[OneWayAttribute()]
void NotifyECRegistered(int ecID);
}

// event sink class
public class EventManager : MarshalByRefObject, EventTarget
{ ... }

// hosting object
public class EventConsumer : MarshalByRefObject
{...
public void RegisterTarget(EventTarget target, string condition)
{
targets.Add(target, condition);
}...
}

// client

RemotingConfiguration.RegisterWellKnownClientType(typeof(EventConsumer),
http://localhost:8989/EventConsumer.rem);

EventConsumer consumer = new EventConsumer();
EventManager manager = new EventManager();

consumer.RegisterTarget(manager, "");

The error occurs on the last line.

What am I doing wrong?

Many thanks!

Pavel Gusak
11/26/2003 12:06:54 AM
Yes, thank you. I've already read it. However, it happens even I compile all
components by .NET 1.0 compilers, so it does not seem to be related to 1.1.

BTW, I do not use .config file to configure client side. I use
RemotingConfiguration.RegisterWellKnownClientType(). Is that ok?

Thank you again.

Pavel

[quoted text, click to view]

Lloyd Dupont
11/26/2003 2:40:42 PM
it's not because you compile 1.0 that you use 1.0 !
(it depends on what it's installed on the target computer)
if you absolutely want to use 1.0 you should specify it inside the manifest
file !

[quoted text, click to view]

Sebastien Lambla
11/26/2003 3:42:14 PM
If you've read it, you would have read:
If you prefer to setup your channels in source code, you have to use the
extended constructor of the HttpChannel or TcpChannel to pass a custom
IFormatterSinkProvider object:...

So re read it :) It's not dependent of which type you register, but which
channel.

And as for "compiling", this is different from "running", and as Lloyd said,
you ARE running on the 1.1 framework if you have this problem, nothing to do
with your compiler. You should state the binding to 1.0 in your manifest.


--
Sebastien Lambla
http://thetechnologist.is-a-geek.com/blog/


"Pavel Gusak" <pgusak@ukr.net> a écrit dans le message de news:
u4ndtB6sDHA.1884@TK2MSFTNGP10.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button