using a COM library in a SQL CLR procedure

M

mtmcclellan

I've installed a COM object on my machine and a development server
(that is running SQL 2005). On my machine, a wrote a quick command
line app to test usage of the COM object and it works. I copied the
application to the server and it works there too. When I write a new
class library application using the COM object the same way, but in a
method that will be a SQL CLR procedure it fails. The assembly and
stored procedure are successfully created, but when I execute the
procedure, I get the error below. Any ideas about what is causing the
problem, how to solve it, or where to start looking for the solution?
Thanks.

Msg 10314, Level 16, State 11, Line 2
An error occurred in the Microsoft .NET Framework while trying to load
assembly id 65681. The server may be running out of resources, or the
assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or
UNSAFE. Run the query again, or check documentation to see how to
solve the assembly trust issues. For more information about this
error:

System.IO.FileLoadException: Could not load file or assembly
'nameparsemelissadata, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null' or one of its dependencies. The given assembly
name or codebase was invalid. (Exception from HRESULT: 0x80131047)
System.IO.FileLoadException:
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint,
StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean
forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName
assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark,
Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString,
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean
forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
 
M

mtmcclellan

I've installed a COM object on my machine and a development server
(that is running SQL 2005). On my machine, a wrote a quick command
line app to test usage of the COM object and it works. I copied the
application to the server and it works there too. When I write a new
class library application using the COM object the same way, but in a
method that will be a SQL CLR procedure it fails. The assembly and
stored procedure are successfully created, but when I execute the
procedure, I get the error below. Any ideas about what is causing the
problem, how to solve it, or where to start looking for the solution?
Thanks.

Msg 10314, Level 16, State 11, Line 2
An error occurred in the Microsoft .NET Framework while trying to load
assembly id 65681. The server may be running out of resources, or the
assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or
UNSAFE. Run the query again, or check documentation to see how to
solve the assembly trust issues. For more information about this
error:

System.IO.FileLoadException: Could not load file or assembly
'nameparsemelissadata, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null' or one of its dependencies. The given assembly
name or codebase was invalid. (Exception from HRESULT: 0x80131047)
System.IO.FileLoadException:
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint,
StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean
forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName
assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark,
Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString,
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean
forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)


The SQL assembly was created with PERMISSION_SET = UNSAFE.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top