RE: Can't Create Asymmetric Key




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.

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
--
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)
.

.



Relevant Pages

  • Re: Code Access Security Issue - Hosting .NET Windows Forms Controls i
    ... PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, ... assemblyOrString, PermissionSet granted, PermissionSet refused, ... Win32 Version: 2.0.50727.832 ... CodeBase: ...
    (microsoft.public.dotnet.security)
  • Embedded .net Windows Forms Control Security Issue
    ... asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle ... RuntimeMethodHandle rmh, SecurityAction action, Object demand, ... RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction ... Win32 Version: 2.0.50727.42 ...
    (microsoft.public.dotnet.framework.aspnet)
  • CAS exception - crash
    ... asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle ... RuntimeMethodHandle rmh, SecurityAction action, Object demand, ... RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction ...
    (microsoft.public.dotnet.security)
  • Code Access Security Issue - Hosting .NET Windows Forms Controls i
    ... PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, ... rmh, Object assemblyOrString, SecurityAction action, Boolean throwException) ... Win32 Version: 2.0.50727.832 ... CodeBase: ...
    (microsoft.public.dotnet.security)