Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / General / Security / March 2006

Tip: Looking for answers? Try searching our database.

Can't Create Asymmetric Key

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
randy1200 - 29 Mar 2006 20:33 GMT
I'm trying to get my first clr stored procedure going.

I believe I was able to create the clr stored procedure in visual studio,
set 'clr enabled' on the server, create an assembly, create an sp based on
the external name, and finally EXEC it from T-SQL to call it. When I call it,
I get the System.Security.HostProtectionException below.

I read the documentation, and decided I needed to create an asymmetric key
to give myself permission to execute the clr stored procedure. I tried the
following in SS Management Studio:

CREATE ASYMMETRIC KEY SQLCLRTestKey FROM EXECUTABLE FILE =
'D:\ClrStoredProcedures\ClrStoredProcedures.dll'

This generates the following error:

Msg 15208, Level 16, State 1, Line 1
The certificate, asymmetric key, or private key file does not exist or has
invalid format.

Any suggestions on how to create the asymmetric key? The error seems to be
saying that I can't create the key because I don't already have one.

Thanks
Signature

Randy

Msg 6522, Level 16, State 1, Procedure sp_DotNetFunSProcPrint, Line 0
A .NET Framework error occurred during execution of user defined routine or
aggregate 'sp_DotNetFunSProcPrint':
System.Security.HostProtectionException: Attempted to perform an operation
that was forbidden by the CLR host.

The protected resources (only available with full trust) were: All
The demanded resources were: UI

System.Security.HostProtectionException:
  at
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm,
PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh,
SecurityAction action, Object demand, IPermission permThatFailed)
  at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object
assemblyOrString, PermissionSet granted, PermissionSet refused,
RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission
permThatFailed)
  at System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet
grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle
rmh, Object assemblyOrString, SecurityAction action, Boolean throwException)
  at
System.Security.CodeAccessSecurityEngine.CheckSetHelper(CompressedStack cs,
PermissionSet grants, PermissionSet refused, PermissionSet demands,
RuntimeMethodHandle rmh, Assembly asm, SecurityAction action)
  at ClrStoredProcedures.TestClrStoredProcedure.PrintMessage(String Message)
.

Steven Cheng[MSFT] - 30 Mar 2006 06:31 GMT
Hi Randy,

Welcome to use MSDN Managed Newsgroup Support.

From your description, my understanding is: you want to create a CLR stored
procedure and get the System.Security.HostProtectionException error.

If I misunderstood your concern, please feel free to point it out.

Based on my experience, the System.Security.HostProtectionException error
most related to your CLR code.

Please first try to follow the step in the SQL 2005 Books Online to create
a CLR stored procedure and deploy it to the database to check if this issue
is related to your code.

http://msdn2.microsoft.com/en-us/library/ms255336.aspx

If you can successfully deploy the stored procedure, would you please post
your CLR stored procedure here so that I could provide further assistance?

If you have installed Visual Studio 2005, you can create a SQL Server
Project and create a CLR stored procedure and then Deploy it to your
database. You may try this method to check if this issue appeared.

Sincerely,

Wei Lu
Microsoft Online Community Support

==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
Signature

This posting is provided "AS IS" with no warranties, and confers no rights.

Kent Tegels - 30 Mar 2006 15:57 GMT
Hello randy1200,

> I believe I was able to create the clr stored procedure in visual
> studio, set 'clr enabled' on the server, create an assembly, create an
> sp based on the external name, and finally EXEC it from T-SQL to call
> it. When I call it, I get the System.Security.HostProtectionException
> below.

Here's the URL for an article I wrote to help with this kind of thing. Its
the same idea the BOL covers, but in more tutorial fashion.

http://www.sqljunkies.com/WebLog/ktegels/articles/SigningSQLCLRAssemblies.aspx

Thank you,
Kent Tegels
DevelopMentor
http://staff.develop.com/ktegels/
hongju - 31 Mar 2006 06:00 GMT
You first make a assembly using CREATE ASSEMBLY statement.
And your guery must modify FROM clause.

ASSEMBLY Assembly_Name

"randy1200"님이 작성한 내용:

> I'm trying to get my first clr stored procedure going.
>
[quoted text clipped - 20 lines]
>
> Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.