Groups | Blog | Home
all groups > dotnet remoting > august 2005 >

dotnet remoting : How to pass OleDbParameter object across domain?


Prodip Saha
8/2/2005 6:39:25 PM
I am sure many of you have encountered similar problem when you try to =
pass an OleDbParameter object from client to Remote Service. You will =
get a nice message saying - Because of security restrictions, the type =
System.Runtime.Remoting.ObjRef cannot be accessed.

This has to do with the Serialization of the OleDbParameter object. When =
the Remote client try to make the call to Service method, it fails. How =
do we fix this?

Microsoft has some documentation on ObjRef and Remoting -
http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/dnnets=
ec/html/THCMCh21.asp

In the above article it says-=20
If the object passed as a parameter derives from =
System.MarshalByRefObject, it is passed by reference. In this case, the =
object requires a URL to support call backs to the client. It is =
possible for the client URL to be spoofed, which can result in a call =
back to an alternate computer.

Well, OleDbParameter meets this criteria because it implements =
MarshalByRefObject. I did not quite understand about the URL part. I =
will appreciate any help you can offer.

Client config file:
<?xml version=3D"1.0" encoding=3D"utf-8" ?>
<configuration>
<system.runtime.remoting>
<application name=3D"test">
<channels>
<channel ref=3D"tcp" port=3D"0" useDefaultCredentials=3D"true">
<channelSinkProviders>
<clientProviders>
<formatter ref=3D"soap" />
<formatter ref=3D"binary" ></formatter>
</clientProviders>
<serverProviders>
<formatter ref=3D"soap" typeFilterLevel=3D"Full" />
<formatter ref=3D"binary" typeFilterLevel=3D"Full" />
</serverProviders>
</channelSinkProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>

Thanks,
Prodip
Prodip Saha
8/4/2005 5:34:31 PM
Just to keep you informed on this issue- I got the problem resolved.=20

The error message was confusing and I was not able to identify the =
target initially. Today, I was able to identify the target (method) by =
changing the way to configure the remoting. Previously we were using =
configuration file to configure channel formatter but we can get more =
appropriate message if we configure through code. Why? I don't know.=20

Interestingly, the exception was thrown from server side. Actual problem =
was- Permission denied: cannot call non-public or static methods =
remotely. Transparent_proxy/remote_proxy (server side) was trying to =
access a private method (System.Data.OleDb.OleDbParameter.get_Parent()) =
on the client and for whatever reason it does not work. I twicked the =
target method on the server and it works. OleDbParameter[] can now =
safely be transmitted to the remote server.

Thanks,
Prodip
www.aspnet4you.com


[quoted text, click to view]
I am sure many of you have encountered similar problem when you try to =
pass an OleDbParameter object from client to Remote Service. You will =
get a nice message saying - Because of security restrictions, the type =
System.Runtime.Remoting.ObjRef cannot be accessed.

This has to do with the Serialization of the OleDbParameter object. =
When the Remote client try to make the call to Service method, it fails. =
How do we fix this?

Microsoft has some documentation on ObjRef and Remoting -
=
http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/dnnets=
ec/html/THCMCh21.asp

In the above article it says-=20
If the object passed as a parameter derives from =
System.MarshalByRefObject, it is passed by reference. In this case, the =
object requires a URL to support call backs to the client. It is =
possible for the client URL to be spoofed, which can result in a call =
back to an alternate computer.

Well, OleDbParameter meets this criteria because it implements =
MarshalByRefObject. I did not quite understand about the URL part. I =
will appreciate any help you can offer.

Client config file:
<?xml version=3D"1.0" encoding=3D"utf-8" ?>
<configuration>
<system.runtime.remoting>
<application name=3D"test">
<channels>
<channel ref=3D"tcp" port=3D"0" useDefaultCredentials=3D"true">
<channelSinkProviders>
<clientProviders>
<formatter ref=3D"soap" />
<formatter ref=3D"binary" ></formatter>
</clientProviders>
<serverProviders>
<formatter ref=3D"soap" typeFilterLevel=3D"Full" />
<formatter ref=3D"binary" typeFilterLevel=3D"Full" />
</serverProviders>
</channelSinkProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>

Thanks,
Prodip
AddThis Social Bookmark Button