我之前使用 VS 2010 创建了一个程序集并使用密钥对其进行了签名。我在下面运行了一个这样的脚本:
USE master;
GO
CREATE ASYMMETRIC KEY SQLCLRPSBatch20Key FROM EXECUTABLE FILE = 'C:\Unsafe\MyDLL.dll';
CREATE LOGIN SQLCLRPSBatch20Login FROM ASYMMETRIC KEY SQLCLRPSBatch20Key;
GRANT UNSAFE ASSEMBLY TO SQLCLRPSBatch20Login;
GO
use MyDB;
GO
// create assembly script here to install unsafe assembly
现在,每次我将程序集放到数据库上并重新安装以更新它时,我是否需要这样做并创建一个新密钥并登录?
当我这样做时,我得到:
Msg 15396, Level 16, State 1, Line 2
An asymmetric key with name 'SQLCLRPSBatch20Key' already exists or this asymmetric key already has been added to the database.
Msg 15151, Level 16, State 1, Line 3
Cannot find the asymmetric key 'SQLCLRPSBatch20Key', because it does not exist or you do not have permission.
Msg 15151, Level 16, State 1, Line 4
Cannot find the login 'SQLCLRPSBatch20Login', because it does not exist or you do not have permission.
所以我想既然程序集是以相同的方式创建和签名的,我只需要安装它。这个对吗?