locked
Just first access, SerializationException: Unable to find assembly

    Question

  • Hello,

    I have seen different flavour of this problem in different places, but as far as I concern none of them has a solution for it. I am using Remoting, .Net2.0, and C#. The server components are running as Windows Service.

    Whenever the service gets started (restart or install) Only the first access to the service throws the following exception.

    SerializationException: Unable to find assembly

    The subsequents access are working fine.

    Any idea why this happens?

    Many thanks,

    Monday, August 14, 2006 11:49 PM

Answers

  • to m4ysam:

    I am not quite sure why do you want to have access to the signature, after all it is a on-way encrypted  (SHA hash). The signature is for data integrity, that means if someone tampered with your assembly the assembly will not load in memory.

    On remoting you can access severy objects, in two ways Client Activation, Server Activation. With server activation you just serialize your call (along with the parameters and stuff) to the server object and everything else is handle by .Net environment. You can pretty much consider remoting as an enhanced version of RPC. Even in case of Client activation you are locating the assemblies in the client side but you are not passing them on the network.

    Read this:

    http://msdn2.microsoft.com/en-us/library/y0h540a7.aspx

    Server activation has two flavour, singleton and singlecall. Singleton pretty much is useless, except for rare cases. You most likely want singlecall and you should remember that your server components are stateless.

    I can also recomment you a book on the subjest:

    http://www.amazon.ca/gp/product/0596102070/sr=8-1/qid=1156180917/ref=sr_1_1/702-1882475-5985627?ie=UTF8&s=gateway

    This book has just one chapter on remoting subject but I find it very insightful and also very deep.

    hope this helps. 

     

     

     

     

    Monday, August 21, 2006 5:22 PM

All replies

  • You can use the Fusion Log Viewer to see what assembly it is trying to load and where it is trying to load it from.

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/html/cpgrfFusionLogViewerFuslogvwexe.asp

     

    Tuesday, August 15, 2006 3:15 PM
  • Thanks Gandalf!

    I have tried that and i am not seeing anything in the detail list. Is it suppose to log the failed assembly automatically?

    By the way it is just one specific assembly which I know the name and the thing is, it just happens the first time, if I click on the message box, which is notifying the user about the error, and again repeat what I did before then it works fine. This error will comeback everytime I restart the windows service.

    Everything was working fine, until I signed that specific assembly and again remove the signature, then the problem starts.

    Any idea why this happens?

    many thanks.

    Tuesday, August 15, 2006 5:52 PM
  • Does anyone know why is this happening?

    I have delete all the obj, and bin directories in entire solution, but no luck. For some reason after this problem appeared I am not able to debug the server side either.

    Please help!

    Wednesday, August 16, 2006 1:23 AM
  • The utility is a little screwy, I've found the best way to get results is to set it to log to a folder of your choice, and to log everything, then run your application, then look in the folder and there will be a bunch of files you can look at with information in them.
    Wednesday, August 16, 2006 4:34 PM
  • Thanks Gandolf. It works fine now, and I can see the error. It says:

    Using application configuration file: <config path>
    Using machine configuration file from: <Machine config path>
    Attempting download of new URL file: <Client application executable path/name_of_the_assembly.dll>
    Attempting download of new URL file: <Client application executable path/name_of_the_assembly/name_of_the_assembly.dll>
    Attempting download of new URL file: <Client application executable path/name_of_the_assembly.exe>
    Attempting download of new URL file: <Client application executable path/name_of_the_assembly/name_of_the_assembly.exe>
    All probing URLs attempted and failed.
     

    I am not quite sure why that assembly is going to be dowloaded by the client, the assembly is on the server side and the client suppose to have access to itthrough Marshaling by reference.

    I have checked the dependencies of the all the client's assemblies and this specific assembly is not included in their dependency directly or indirectly.

     

    Again this error happen on the first attempt to access the server service, the subsequents access are working fine, and I can't see this assembly in the client directory.

     

    Do you know why this happens?

     

    Many thanks,

     

     

    Wednesday, August 16, 2006 6:01 PM
  • Try copying the file to the client side and see if the error goes away.  That will give you a clue.

    Usually you need a copy of the DLL you are remoting to on the client side, unless you do some tricks that are kind of a pain in the neck and not really worth the effort unless you have a specific requirement to not have the server library on the client side.

    Thursday, August 17, 2006 10:08 PM
  • I am not quite sure if I understand you correctly. I am accessing the server component by marshaling the argument of the server methods, this way I only need the proxy object of the server in the client side, not the actuall objects. The proxy object are built by .Net itself so I do not need to be worry about them. The whole process is very simple and think of it as similar to using a web service. Do you need to have the Web Service component when you call their methods? of course not.

    The other thing is, the application was working fine and the problem started as soon as I signed one specific assembly on the server, to test something, then I remove the signature and after that the problem appear.

    Now here is my question If I copy the server component to the client, is it possible to know what component and which method is trying to access the server component?

    Many thanks for your help

    Thursday, August 17, 2006 11:44 PM
  • If you look at the exception stack trace you can see what code is trying to access the server component locally, drill into the inner exception, there might be some information there.  If you attach with a debugger you can probably pick up a call stack (changing CLR exceptions to break when thrown might help as well).

    Can you post some sample code? 

    The other problem may just be some sort of oddball references problem, presumably you already blew everything away and put fresh copies of all libraries/executables in place?  Reflector is a good tool for figuring out if you have old libraries hanging around screwing things up.  It makes a certain amount of sense as well, because the error that comes up is assembly not found, regardless of whether you have a version mismatch, or signing mismatch, or the file just plain isn't there.

    Friday, August 18, 2006 5:16 PM
  • First let me thank you for following up on this error.

    I check the call stack and no usefull information there it actually complains that RealProxy invoke is failed.

    I couldn't reproduce the problem and the actual code is scattered in the 22 projects, but I did simlpify it in the following diagram:

     

    And as for the reflector I have already check that and there is no reference to DataPortal assembly (problemitic assembly) whatsoever!

    At the moment when I install the application on the client side, I run it, and ignore the error then everything goes fine.

    Any idea?

    many thanks.

    Friday, August 18, 2006 7:17 PM
  • In your test, is the server and client code running on the same box?  If not, make sure you run the fusion log viewer on the server box, that looks like where the problem is based on your diagram.
    Friday, August 18, 2006 8:20 PM
  • Also, maybe do FileMon on both boxes and filter for the dll that it is trying to load.
    Friday, August 18, 2006 8:25 PM
  • Actually I am getting this error, on my development box (as well as test environment). On my development both client and server are in the same machine. The FusLogVw is saying that my UI component is trying to find the DataPortal component and it can't!
    Saturday, August 19, 2006 1:26 AM
  • I would split up to two physcal boxes and watch the fusion log viewer.  I think it got confused, I can't see how it would decide that the client was looking for the file when the error happens in the server side code.
    Monday, August 21, 2006 3:49 PM
  • Hi Kadabba
    I've just recently started learning .net remoting and am kind of newbie in this field.
    Would you please tell me how I can have access to remote objects' signatures without having a copy of the remote object on the client side?
    Thanks in advance
    Monday, August 21, 2006 4:45 PM
  • to m4ysam:

    I am not quite sure why do you want to have access to the signature, after all it is a on-way encrypted  (SHA hash). The signature is for data integrity, that means if someone tampered with your assembly the assembly will not load in memory.

    On remoting you can access severy objects, in two ways Client Activation, Server Activation. With server activation you just serialize your call (along with the parameters and stuff) to the server object and everything else is handle by .Net environment. You can pretty much consider remoting as an enhanced version of RPC. Even in case of Client activation you are locating the assemblies in the client side but you are not passing them on the network.

    Read this:

    http://msdn2.microsoft.com/en-us/library/y0h540a7.aspx

    Server activation has two flavour, singleton and singlecall. Singleton pretty much is useless, except for rare cases. You most likely want singlecall and you should remember that your server components are stateless.

    I can also recomment you a book on the subjest:

    http://www.amazon.ca/gp/product/0596102070/sr=8-1/qid=1156180917/ref=sr_1_1/702-1882475-5985627?ie=UTF8&s=gateway

    This book has just one chapter on remoting subject but I find it very insightful and also very deep.

    hope this helps. 

     

     

     

     

    Monday, August 21, 2006 5:22 PM