+ Start a Discussion

Salesforce web service integration using CLR, .net 2.0 and sqlserver 2005

Hello everyone.

I was hoping someone out there may have come accross a solution to an issue I am currently having.

I have a winform project that I am moving over to a CLR stored procedure that will automatically update

Contacts on salesforce when changes are made to our db. The initial development for the winform was

easy enough to create but once I put it into a CLR project the web reference presents problems.

It builds, compiles and deploys fine but throws an error when I try to run it from SSMS. After

researching out the error below I serialized the .dll using sgen.exe from the command line and

successfull created and added the foo.xmlserializers.dll file to the project, I added the pre and post

deployment scripts necessary to add and drop the serialization assembly and am still recieving

the same error after I deploy the project.

If you recognize the method and the error and have a possible solution for me the help would be greatly

appreciated. It is for .net 2.0 and sqlserver 2005.


The error:

Msg 6522, Level 16, State 1, Procedure SynchronizeSalesforceContactDetails, Line 0

A .NET Framework error occurred during execution of user-defined routine or aggregate "SynchronizeSalesforceContactDetails":

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.


at System.Reflection.Assembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection)

at System.Reflection.Assembly.Load(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence securityEvidence)

at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)

at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, St



at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)

at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)

at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)

at System.Xml.Serialization.XmlSerializer.GetSerializersFromCache(XmlMapping[] mappings, Type type)

at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type)

at System.Web.Services.Protocols.SoapClientType..ctor(Type type)

at System.Web.Services.Protocols.SoapHttpClientProtocol..ctor()

at salesforceContactUpdate.ForceWebReference.SforceService..ctor()

at salesforceContactUpdate.UserDefinedFunctions.SynchronizeSalesforceCo...



I would check this out ...

        LoadFrom(), LoadFile(), Load(byte[]) and LoadModule() have been disabled by the host.


this says to me that the create assembly call that was made to add the assembly to the db created the assembly with some restrictions on what it can do, defined at server / database level.


Does your account have the rights to override this? ... if so re-attach the assembly with full permissions. you may have to set the full permissions property on the db itself too.