0
votes

I am trying to create a SQL CLR that runs as a function. This has to have a dependency to the RabbitMQ.Client.dll. So far I have downloaded it and created an assembly on my SQL Server as follows:

CREATE ASSEMBLY [RabbitMQ.Client] 
FROM 'C:\Users\MyUser\Documents\RabbitMQ.Client.dll'
WITH PERMISSION_SET = SAFE

This way, I can go to my database project on VS and use the tools provided from such assembly. I created a function which should be called like this:

SELECT dbo.RabbitEnqueue(3)

However, running this returns an exception:

Msg 6522, Level 16, State 1, Line 30
A .NET Framework error occurred during execution of user-defined routine or aggregate "RabbitEnqueue":
System.IO.FileLoadException: Could not load file or assembly 'RabbitMQ.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89e7d7c5feba84ce' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)

System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)

at UserDefinedFunctions.RabbitEnqueue(Int32 myId) .

According to the RabbitMQ website, their assembly is strongly named:

The client assembly is strong named. The public key token is 89e7d7c5feba84ce and the public part of the signing key is

00240000048000009400000006020000002400005253413100040000010001008d20ec856aeeb8 c3153a77faa2d80e6e43b5db93224a20cc7ae384f65f142e89730e2ff0fcc5d578bbe96fa98a71 96c77329efdee4579b3814c0789e5a39b51df6edd75b602a33ceabdfcf19a3feb832f31d825416 8cd7ba5700dfbca301fbf8db614ba41ba18474de0a5f4c2d51c995bc3636c641c8cbe76f45717b fcb943b5.

What am I missing here?

1
Have you tried sn -vf to verify the signature at the command-line?Marc Gravell♦
I get the following: "Failed to verify assembly -- Strong name validation failed"Luis Becerril
I was able to solve this, I had downloaded the assembly from nuget, it turns out I had to directly download the dll from their site, thanks!Luis Becerril
@LuisBecerril post it as an answer instead of a comment then accept the answer in two days when you can. If you don't this will keep comming up to the front page as a question with no accepted answer.Scott Chamberlain

1 Answers

0
votes

I was able to solve this, I had downloaded the assembly from nuget, it turns out I had to directly download the dll from their site which turns out to be strongly named.