locked
SerializationException "Unable to find assembly" RRS feed

  • Question

  • I've created a component daPersonFactory that inherits ServicedComponent indirectly - meaning it inherits an abstract base class daDataFactoryBase, which in turn inherits ServicedComponent. This daPersonFactory has a method with this signature:

    public blPersons SetSelect(daCommand prmCommand, blPersons prmObjectCollection) {blah blah blah}

    All was working well when ApplicationActivation was set to 'Library', but when I changed the activation to 'Server', the call blows up with a SerializationException that tells me the assembly containing the prmCommand parameter cannot be found (stack trace below).

    This is undoubtedly a dumb ole newbie question, so please forgive my ignorance. But why is this happening? I'm still in development, so all components are on the same computer. The assemblies containing daCommand and blPersons - the classes mentioned on the SetSelect() call and the SerializationException message  - are all marked with SerializableAttribute, and their assemblies are strong-named, signed, and in the GAC. Also, I have tested that both daCommand and blPersons can be serialized and de-serialized to disk and back using BinaryFormatter without any problems. So it can't be that the arguments in question don't serialize properly.

    Since encountering this problem I've read up a little on .NET remoting, and I understand - at least in principle - that remoting components require <system.runtime.remoting> .config file entries on both client and server ends, but somehow I thought that for ServicedComponent-derived classes, as opposed to ones that inherit the simpler MarshalByRefObject, all this was somehow handled automatically. I do understand that my daPersonFactory component is now running inside dllhost, but the manifest for its assembly has all the necessary external assembly references, non?

    Aaaaaaanyway, do I need to create .config file entries after all? Should I test my serialization using some other means than BinaryFormatter? Is there some other problem?

    Thanks in advance,

    -BillyB (COM+ newbie)

     ExceptionType: SerializationException
     Message: Unable to find assembly 'Bmt.InOurLeague.DataAccess.Command, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e1e56637e3870fed'.
     Source: mscorlib
     StackTrace:    at System.EnterpriseServices.IRemoteDispatch.RemoteDispatchNotAutoDone(String s)
       at System.EnterpriseServices.RemoteServicedComponentProxy.Invoke(IMessage reqMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at Bmt.InOurLeague.DataAccess.daPersonFactory.SetSelect(daCommand prmCommand, blPersons prmObjectCollection)
       at Bmt.InOurLeague.BusinessLogic.Test.t_blPerson.t_blPerson_Basic_0001() in C:\Data\Visual Studio 2005\Projects\BMT\InOurLeague\IolBusinessLogic\IolBlTest\Class\t_blPerson.cs:line 130
     TargetSite: System.String RemoteDispatchNotAutoDone(System.String)

    Friday, December 22, 2006 6:22 PM

Answers

  • I've done some research and learned several things since making this post:

    1. My code was fact working all along! If I just wait for a period of time after stopping and starting a COM+ component in the Component Services Administrator, it all "just works". Best I can tell, this period of time is 3 minutes, which by coincidence is the amount of time for the setting "Minutes until idle shutdown" on the Advanced Tab for the component in Component Services Administrator. Or is it a coincidence?
    2. I will OF COURSE need to perform configuration in code or .config files in order for the client to locate the remote object once client and server are on different computers. The only reason my code worked without configuration was that everything is still in development on one XP Pro machine. Duh.

     

    Hey, I did say I was a COM+ newbie.  Apologies for cluttering up the airwaves with such basic questions.

    -BillyB

    Sunday, December 24, 2006 9:48 PM