Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I know this question has been asked before, but none of the answers I've tried seem to work for me.

I'm trying to execute a CLR Stored Procedure in Sql Server 2005. The CLR generates a file, sends it to a webservice, reads the XML response (using .net's XML serialization classes) and logs the result.

When I try to execute it, I get this error:

System.InvalidOperationException: Cannot load dynamically generated serialization assembly. In some hosting environments assembly load functionality is restricted, consider using pre-generated serializer.

Supposedly, this can be fixed by using the XML Serializer Generator tool (Sgen.exe) to create the XML serialization assembly for the original assembly manually and then loading the assemblies into the SQL Server database. (See here, here and here)

I've generated the XML Serialization assembly, loaded into the database, and decorated the serialization classes using the XmlSerializerAssembly attribute. Still get the same error.

I've tried using different versions of the sgen.exe tool and toyed with different permission sets for the assemblies, to no avail.

What am I missing? Is there some configuration in the server that can prevent this from working?

share|improve this question
In your research, did you also read the countless warnings to not use SQLCLR to connect to webservices? –  Remus Rusanu Nov 28 '13 at 14:32
@RemusRusanu yes, I did. Unfortunately, using the clr to connect to the webservice is not really my call to make. I'd still like to make this work. –  jlasarte Nov 28 '13 at 14:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.