System.Runtime.Serialization.SerializationException: 无法找到程序集!
当Remoting客户端需要订阅Remoting服务的事件时,你可能会收到下面的异常:
System.Runtime.Serialization.SerializationException: 无法找到程序集
TestServiceLibrary, Version=1.0.1827.29318, Culture=neutral, PublicKeyToken=null。
Server stack trace:
at System.DelegateSerializationHolder.GetDelegate(DelegateEntry de)
at System.DelegateSerializationHolder.GetRealObject(StreamingContext context)
at System.Runtime.Serialization.ObjectManager.ResolveObjectReference(ObjectHo
lder holder)
at System.Runtime.Serialization.ObjectManager.DoFixups()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(He
aderHandler handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMessag
e methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize
(Stream serializationStream, HeaderHandler handler, Boolean fCheck, IMethodCallM
essage methodCallMessage)
at System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryRequestMessa
ge(String objectUri, Stream inputStream, Boolean bStrictBinding, TypeFilterLevel
securityLevel)
at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(
IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders reques
tHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& respon
seHeaders, Stream& responseStream)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req
Msg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgDa
ta, Int32 type)
at Sinosky.MessageCenter.MessageRelay.add_MessageDispatched(MessageDispatched
Handler value)
at Sinosky.Testing.TestRelayBridge.Run() in C:\Documents and Settings\leon\My
Documents\Visual Studio Projects\TestServiceLibrary\TestRelayBridge.cs:line 45
这是由于服务器端序列化代理的时候需要客户端的程序集,所以将客户端程序集拷贝到服务器端即可。