all groups > dotnet remoting > february 2005 >
You're in the

dotnet remoting

group:

Forwarding a remotely retrieved object.


Forwarding a remotely retrieved object. Stefan Rosi
2/26/2005 6:33:01 PM
dotnet remoting: Hallo everybody,

I wrote a dll to manage the operations with the database; this dll includes
only one class inherited from MarshalByRefObject

and almost all its functions take and/or return DataSets(i.e. serializable
objects).

This dll should be accessed remotely from the ASp.Net component. For
security reasons the ASP.NET computer should have no

direct access to the computer hosting this dll.

So I programmed a wrapper class which just gets a proxy to the hosted object
and returns it (remotely) to the ASP.NET layer.

All objects are hosted using the IIS and the standard HttpChannel.

Anyways I was getting the error "The underlying connection was closed".

When I modified the proxy class (i.e. the class which retrieves the data
component and returns it to the ASP.NET) so that

it just returns a locally instantiated object everything worked ok. When I
prevented the proxy class from acting like a server

and tried to get the remote data component everything works also ok.

I GUESS when the proxy class receives a request from the ASP.NET component
it breaks the connection with it in order to

establish a connection with the server hosting the dll (maybe because both
connection use the http channel on port 80). But I

don't know what to do.



Can anybody help me to solve this problem? Or does any body know a better
approach to do it.



The proxy class looks like this


Class ProxyClass
{
public DataComp GetDataComp()
{
DataCom dComp = (DataComp)
Activator.GetObject(typeof(DataComp),"theDataCompURL");
// pass the network credential
return dComp;
}
}

And on the ASP.NET server i use

ProxyClass prox = (ProxyClass)
Activator.GetObject(typeof(ProxyClass),"theDataCompURL");
DataComp dComp = prox.GetDataComp();

Thanks alot in advance
Stefan

Re: Forwarding a remotely retrieved object. Sunny
2/26/2005 10:38:22 PM

[quoted text, click to view]

Stefan,
You mean - no direct network access?

If so, it's normal that it does not work. When you return the object from
your wrapper, actually you pass only ObjRef, so the receiving component
will try to connect to the original object directly. And if there is no
direct network access, it will fail.

If I do not understand you correctly, please clarify.

Re: Forwarding a remotely retrieved object. Stefan Rosi
3/1/2005 5:13:15 PM
Sunny,

thanks for your response, you are right; there is no direct connect.

I thought when I do so, all parameters will be passed through the proxy
computer and not that the asp.net computer will try to connect directly to
the computer hosting the dll.



Does anybody know how can I force the connection to be established through
the proxy computer and not directly?

Thanks again

Stefan






"Sunny" <sunny@newsgroups.nospam> schrieb im Newsbeitrag
news:%23QkgsYIHFHA.3624@tk2msftngp13.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button