5

I am using visual studio 2012 and MS SQL Server 2012. I created SQL CLR project and followed the steps according to the following link http://blogs.interfacett.com/how-create-net-stored-procedure-sql-server

Now when I insert data in the table with which I attached a trigger, the data is inserted, but I get the following error. "Request for the permission of type 'System.Net.WebPermission, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."

Can anyone tell me, how I can fix it?

Thanks in advance.

7
  • Change the permission set of the registered assembly to "Unrestricted" and check the result. Commented Jan 30, 2013 at 10:36
  • I am not allowed to change it. Its says "Alter Failed". Commented Jan 30, 2013 at 10:39
  • Why?! By which user you logged into the SQL? Also give me the error details please. Commented Jan 30, 2013 at 10:41
  • I am logged in with Windows default Commented Jan 30, 2013 at 10:42
  • 2
    Alter Database NotificationSystem Set Trustworthy On; Execute this, then alter the assembly permission set. The reason of this is that you should tell the server to trust this database first, then you can have some unrestricted assemblies inside your database. Commented Jan 30, 2013 at 10:50

1 Answer 1

6

Do not make web calls from triggers. Use a queue do decouple the transactional data operation from the non-transactional HTTP call. Do not make web calls from inside SQL CLR. Use an external process that makes the HTTP call.

Follow the permission requirements for code access as described in CLR Integration Code Access Security:

EXTERNAL_ACCESS assemblies also have the following permissions and values:
...
WebPermission Connect: Outbound connections to web resources are allowed.

Sign up to request clarification or add additional context in comments.

1 Comment

oh God, I am making web calls from here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.