rperryman
asked on
Cannot load dynamically generated serialization assembly. Help! Visual Studio 2010 SQL CLR utilizing a Web Service - SQL 2008 -
Hi Experts,
I am building a Stored Procedure in .NET utilizing SQL CLR. The point of the SQL CLR is to connect to a Web Service. After I deploy I get the error following this message when attempting to run the Stored Procedure.
Everything I find on the net is not Visual Studio 2010 related. I have options to Generate the Serialization Assembly in 2010 which I have set to On. Permissions are UnSafe and I've tried Safe but it won't deploy if Safe. Most of the web says I have to run Create Assembly but the Assembly is in Assemblies on the Server.
Thanks for your help!
Msg 6522, Level 16, State 1, Procedure CreateSRAsync, Line 0
A .NET Framework error occurred during execution of user-defined routine or aggregate "CreateSRAsync":
System.InvalidOperationExc eption: 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.FileLoadExceptio n: LoadFrom(), LoadFile(), Load(byte[]) and LoadModule() have been disabled by the host.
System.IO.FileLoadExceptio n:
at System.Reflection.Assembly .nLoadImag e(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection)
at System.Reflection.Assembly .Load(Byte [] rawAssembly, Byte[] rawSymbolStore, Evidence securityEvidence)
at Microsoft.CSharp.CSharpCod eGenerator .FromFileB atch(Compi lerParamet ers options, String[] fileNames)
at Microsoft.CSharp.CSharpCod eGenerator .FromSourc eBatch(Com pilerParam eters options, String[] sources)
at Microsoft.CSharp.CSharpCod eGenerator .System.Co deDom.Comp iler.ICode Compiler.C ompileAsse mblyFromSo urceBatch( CompilerPa r
...
System.InvalidOperationExc eption:
at System.Xml.Serialization.C ompiler.Co mpile(Asse mbly parent, String ns, XmlSerializerCompilerParam eters xmlParameters, Evidence evidence)
at System.Xml.Serialization.T empAssembl y.Generate Assembly(X mlMapping[ ] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParam eters parameters, Assembly assembly, Hashtable assemblies)
at System.Xml.Serialization.T empAssembl y..ctor(Xm lMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)
at System.Xml.Serialization.X mlSerializ er.GetSeri alizersFro mCache(Xml Mapping[] mappings, Type type)
at System.Xml.Serialization.X mlSerializ er.FromMap pings(XmlM apping[] mappings, Type type)
at System.Web.Services.Protoc ols.SoapCl ientType.. ctor(Type type)
at System.Web.Services.Protoc ols.SoapHt tpClientPr otocol..ct or()
at Dell.DeltaConnect.Pro...
I am building a Stored Procedure in .NET utilizing SQL CLR. The point of the SQL CLR is to connect to a Web Service. After I deploy I get the error following this message when attempting to run the Stored Procedure.
Everything I find on the net is not Visual Studio 2010 related. I have options to Generate the Serialization Assembly in 2010 which I have set to On. Permissions are UnSafe and I've tried Safe but it won't deploy if Safe. Most of the web says I have to run Create Assembly but the Assembly is in Assemblies on the Server.
Thanks for your help!
Msg 6522, Level 16, State 1, Procedure CreateSRAsync, Line 0
A .NET Framework error occurred during execution of user-defined routine or aggregate "CreateSRAsync":
System.InvalidOperationExc
System.IO.FileLoadExceptio
at System.Reflection.Assembly
at System.Reflection.Assembly
at Microsoft.CSharp.CSharpCod
at Microsoft.CSharp.CSharpCod
at Microsoft.CSharp.CSharpCod
...
System.InvalidOperationExc
at System.Xml.Serialization.C
at System.Xml.Serialization.T
at System.Xml.Serialization.T
at System.Xml.Serialization.X
at System.Xml.Serialization.X
at System.Web.Services.Protoc
at System.Web.Services.Protoc
at Dell.DeltaConnect.Pro...
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Drop procedure InternalStoredProcedureNam
Drop assembly [ClassName.XmlSerializers]
drop assembly ClassName
create assembly ClassName
FROM 'C:\path\putyourdllyoucomp
WITH PERMISSION_SET = UNSAFE;
go
CREATE ASSEMBLY [ClassName.XmlSerializers]
from 'C:\path\putyourdllyoucomp
WITH PERMISSION_SET = SAFE;
GO
Create Procedure InternalStoredProcedureNam
@Parameter2 decimal(10,0),
@Parameter3 nvarchar(max),
@Parameter4 DateTime,
@Parameter5 bigint,
@Parameter6 bit
)
AS EXTERNAL NAME ClassName.StoredProcedures
If this is the first time the drops can be commented out.
Garrett