[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

Problem with serializing business object instead of core objects

alex

9/17/2004 10:31:00 PM

I have created a simple remoting client-server setup where I am having
problems when attempting to deal with business objects. If I run the client
and server, and pass in a standard object such as a string, integer, guid,
etc., everything works fine. However, if I try to pass in a business object
that I have marked as serializable, I get the following error:

Unable to find assembly '__codeyqhbdlhs, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null'.

I have marked the business object as serializable and to test, I created a
simple business object that just has a couple of string fields. The error
also appears to occur when I try to run deserialize or serialize directly on
an object instead of allowing the framework to handle the serialization so
the problem seems to be serialization. The same error occurs whether I use
Binary or SOAP formatters. I am running my server as a windows app. The
relevant code to activate remoting on the server is as follows:

private void button1_Click(object sender, EventArgs e)
{
BinaryServerFormatterSinkProvider ServerProvider = new
BinaryServerFormatterSinkProvider();
TcpServerChannel tsc = new TcpServerChannel("TCPChannel", 7777,
ServerProvider);
ChannelServices.RegisterChannel(tsc);

RemotingConfiguration.RegisterWellKnownServiceType(typeof(ApptikRemoteObject), "ApptikCache", WellKnownObjectMode.SingleCall);

infobox.Items.Add("Initializing cache server initialized");


stopped = false;

}

}


The relevant client portion is run from an asp page and is as follows:

Global.asax
System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider
ClientProvider = new
System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider();
System.Runtime.Remoting.Channels.Tcp.TcpClientChannel tsc = new
System.Runtime.Remoting.Channels.Tcp.TcpClientChannel("TCPChannel",
ClientProvider);
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(tsc);

appobject.aspx

IApptikRemoteCache remoteobj =
(IApptikRemoteCache)Activator.GetObject(typeof(IApptikRemoteCache),
"tcp://localhost:7777/ApptikCache");

RemoteTest findtestvalue = (RemoteTest)
remoteobj.Find("RemoteTestTest11");
if (findtestvalue == null)
{

HttpContext.Current.Trace.Write("Test not found");
// if I pass a string in the next line instead of remotetest object
// then everything works fine
RemoteTest test = new RemoteTest();
remoteobj.Add("RemoteTestTest11", test, null);
}
else
{

HttpContext.Current.Trace.Write("Test " +
findtestvalue.Test2.ToString());

}

The remote class that I am attempting to pass through is as follows:

[Serializable]
public class RemoteTest {

private string test = string.Empty;
private string test2 = string.Empty;
public string Test2
{
get
{
return test2;
}

set
{
test2 = value;
}
}


public RemoteTest()
{

test2 = "Palookaville";

}

}