SQL CLR - "System.InvalidOperationException: Cannot load dynamically generated serialization assembly" with external DLL

Traitée SQL CLR - "System.InvalidOperationException: Cannot load dynamically generated serialization assembly" with external DLL

  • jeudi 29 mars 2012 21:28
     
     

    Yes, I know this question has been asked a million times, but unfortunately the solution I keep seeing is not one that is working for me.

    I am getting this familiar error when trying to call a .NET DLL from SQL - System.InvalidOperationException: Cannot load dynamically generated serialization assembly. In some hosting environments assembly load functionality is restricted, consider using pre-generated serializer. Please see inner exception for more information. ---> System.IO.FileLoadException: LoadFrom(), LoadFile(), Load(byte[]) and LoadModule() have been disabled by the host.

    I know the solution is to use sgen.exe to generate an XmlSerializer.DLL file.  My problem is that the .NET DLL is managed by an external company, and I have no control over it.  It is signed, and I don't have its key to generate a signed XmlSerializer.DLL file for it.  

    Is there any other way around this?  Or am I boned?

    Thanks.

Toutes les réponses

  • jeudi 29 mars 2012 22:12
     
     

    You should probably try the CLR forum instead:
    http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/threads

    I have no clue.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
  • vendredi 30 mars 2012 08:10
    Modérateur
     
     Traitée
    Yes,
    you’re going to need a separate serializer. So I’d suggest contacting the
    external company that provided the DLL and tell them why you need one. Or, if
    you know what web service they’re calling, you can try recoding the web service
    call yourself using native HTTP and SOAP calls. The serializer mechanism in
    general is simply to make a SOAP call look like an object call.  Or, have your
    SQLCLR proc call out to a proxy service (not in SQL Server) to make the web
    service call.

    Seems easier to request a serializer from the company, or use the DLL in middle tier rather than in SQLCLR.

    Cheers,
    Bob
  • lundi 2 avril 2012 18:56
     
     
    Thanks for the info, Bob.  I did indeed recode the web service call using SOAP, and this has been working great so far.