Cannot find the asymmetric key 'MsSqlSpatialLibraryKey'

Topics: Developer Forum, Project Management Forum, User Forum
Jun 10, 2009 at 10:01 PM

Hi,

I have a new function added into the project version mssqlspatial-48758, then try to deploy it into a database which has the mssqlspatial deployed before.

And got the following error:

 

Creating scripts...

Establishing connection...

Dropping assembly dependencies...

Running script 1 of 116...

Running script 2 of 116...

Unhandled Exception: System.ApplicationException: Exception occured executing script:

 

USE master

 

IF NOT EXISTS (SELECT name FROM sys.asymmetric_keys WHERE name=N'MsSqlSpatialLibraryKey')

CREATE ASYMMETRIC KEY [MsSqlSpatialLibraryKey]

FROM EXECUTABLE FILE = N'C:\....\MsSqlSpatialLibrary.dll'

 

IF NOT EXISTS (SELECT name FROM sys.syslogins WHERE name=N'MsSqlSpatialLibraryLogin')

BEGIN

        CREATE LOGIN [MsSqlSpatialLibraryLogin] FROM ASYMMETRIC KEY [MsSqlSpatialLibraryKey]

        REVOKE CONNECT SQL FROM [MsSqlSpatialLibraryLogin]

        GRANT UNSAFE ASSEMBLY TO [MsSqlSpatialLibraryLogin]

END

 

 ---> System.Data.SqlClient.SqlException: The certificate, asymmetric key, or private key file does not exist or has invalid format.

Cannot find the asymmetric key 'MsSqlSpatialLibraryKey', because it does not exist or you do not have permission.

Cannot find the login 'MsSqlSpatialLibraryLogin', because it does not exist or you do not have permission.

Cannot find the login 'MsSqlSpatialLibraryLogin', because it does not exist or you do not have permission.

Changed database context to 'master'.

 

What does that mean?

Do I need to apply for some permission to do that? If so, how can I do that?

Sorry, I'm not quite familiar with this ASYMMETRIC KEY.

Cheers

 

Regards

Steven Gong

Developer
Jun 10, 2009 at 11:09 PM

Hi Steven, make sure the assembly has been signed and you are deploying with UNSAFE or EXTERNAL_ACCESS permissions hth jd