Sunny
6/30/2004 2:45:00 PM
Hi,
DataSet is always serialized to XML. It does not depend on what formater
you are using for remoting. Actually I haven''t any problems with this so
far, but I have seen some people reporting this problem, and in most
cases the problem was that the auto generated class for the typed
DataSet is not shared between the client and server.
SO, try this:
1. Put the xsd and autogenerated .cs file in a separate assembly and
reference it both from the server and the client. In runtime, make sure
that this assembly is accessible both from the server and client (I.e.
there is a copy of it in the corresponding folders). This should solve
the problem.
2. If for some reason the above does not help, as I said DataSets are
always serialized to XML, so you can just use WriteXml to serialize it
in your remote method and return the XML string, and then recreate it
back at the client.
Sunny
In article <O3#QrGhXEHA.2940@TK2MSFTNGP09.phx.gbl>, l_zhou@hotmail.com
says...
> Hi,
> I have my client application call a method in a remote object hosted in IIS.
> The return value is a typed dataset. The problem that I have is the method
> call works fine in server side, but once the return value returns to client
> side, it throws exception: "An unhandled exception of type
> ''System.InvalidCastException'' occurred in mscorlib.dll Additional
> information: Return argument has an invalid type."
> 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)
>
> Has anyone have similiar problem before? I appreciate any response very
> much.
>
>
>