sprungli
6/28/2004 3:33:00 PM
Hello,
I have some pretty simple test code below that attempts to return a DataSet
from a remotable object proxy, RemObj1 (hosted in a IIS server application,
SimpleNETRemotingTest_Host). This happens in the Load event handler of a
Win Form remoting client:
private void RemClient_Load(object sender, System.EventArgs e)
{
HttpClientChannel chnl = new HttpClientChannel();
ChannelServices.RegisterChannel(chnl);
RemotingConfiguration.RegisterWellKnownClientType(typeof(RemObj1),
"http://localhost/SimpleNETRemotingTest_Host/RemObj1.rem");
remObj1 = new RemObj1();
//next line >> System.InvalidCastException: Return argument has an invalid
type.
DataSet ds = remObj1.TestReturningADataSet();
}
Here is the server code:
public DataSet TestReturningADataSet()
{
return new DataSet();
}
I get an InvalidCastException when trying to retrieve the DataSet from the
server. If someone knows why this happens, please reply to the group, cause
I am really stuck here.
TIA for any help.
Below is the full exception message:
************** Exception Text **************
System.InvalidCastException: Return argument has an invalid type.
at System.Runtime.Remoting.Proxies.RealProxy.ValidateReturnArg(Object
arg, Type paramType)
at
System.Runtime.Remoting.Proxies.RealProxy.PropagateOutParameters(IMessage
msg, Object[] outArgs, Object returnValue)
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
at RemoteObject.RemObj1.TestReturningADataSet() in
c:\code\dotnet\simplenetremotingtest\remoteobject\remobj1.cs:line 20
at RemotingClient.RemClient.RemClient_Load(Object sender, EventArgs e) in
c:\code\dotnet\simplenetremotingtest\remotingclient\remclient.cs:line 88
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)