如何注册System.DirectoryServices中为SQL CLR用户功能的使用? [英] How to register System.DirectoryServices for use in SQL CLR User Functions?

查看:336
本文介绍了如何注册System.DirectoryServices中为SQL CLR用户功能的使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我移植一个老3 2位COM 组件,是写在维生素B6 用于阅读的目的和写入一个的Active Directory 服务器。新的解决方案将在 C#并使用 SQL CLR 用户功能。

I am porting an old 32-bit COM component that was written in VB6 for the purpose of reading and writing to an Active Directory server. The new solution will be in C# and will use SQL CLR user functions.

这是我想将其部署到 SQL Server中的组件包含对的System.DirectoryServices 。该项目不编译没有任何错误,但我无法部署大会在 SQL Server,因为下面的错误

The assembly that I am trying to deploy to SQL Server contains a reference to System.DirectoryServices. The project does compile without any errors but I am unable to deploy the assembly to the SQL Server because of the following error:

错误:的System.DirectoryServices,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a'大会在SQL目录中没有被发现。

什么是SQL Server上注册的System.DirectoryServices 正确的步骤?

What are the correct steps for registering System.DirectoryServices on SQL Server?

推荐答案

其他答案所提供的信息使我的解决方案。下面是我想出了以供将来参考以下步骤:

The information provided from other answers led me to the solution. Here are the steps I came up with for future reference:

CREATE ASSEMBLY [System.DirectoryServices]
FROM 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.DirectoryServices.dll'
WITH PERMISSION_SET = UNSAFE
GO

我第一次跑了上面的语句,我得到了以下错误:

The first time I ran the statement above I got the following error:

CREATE组件集System.DirectoryServices失败,因为程序集System.DirectoryServices未获准向PERMISSION_SET =不安全的。当以下任何一种情况是真实的组件授权:数据库所有者(DBO)具有不安全ASSEMBLY权限和数据库有TRUSTWORTHY数据库属性;或组件使用证书或具有不安全ASSEMBLY权限相应的登录对称密钥签名。

CREATE ASSEMBLY for assembly 'System.DirectoryServices' failed because assembly 'System.DirectoryServices' is not authorized for PERMISSION_SET = UNSAFE. The assembly is authorized when either of the following is true: the database owner (DBO) has UNSAFE ASSEMBLY permission and the database has the TRUSTWORTHY database property on; or the assembly is signed with a certificate or an asymmetric key that has a corresponding login with UNSAFE ASSEMBLY permission.

为了获得CREATE ASSEMBLY语句没有错误,我不得不先打开TRUSTWORTHY ON执行如下:

In order to get the CREATE ASSEMBLY statement to execute without error I had to first turn TRUSTWORTHY ON as follows:

ALTER DATABASE DatabaseName SET TRUSTWORTHY ON
GO

在守信是打开,没有错误的命令执行,但它确实present这个可怕的冠冕堂皇的警告:

Once TRUSTWORTHY is turned ON, the command executed without error but it did present this scary sounding warning:

警告:Microsoft .NET框架集System.DirectoryServices,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a,的ProcessorArchitecture = MSIL。您正在注册没有在SQL Server托管环境中经过全面测试,不支持。今后,如果您升级或维修该组件或.NET Framework,您的CLR集成例程可能会停止工作。请参阅SQL Server联机丛书的更多细节。

Warning: The Microsoft .NET Framework assembly 'system.directoryservices, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.' you are registering is not fully tested in the SQL Server hosted environment and is not supported. In the future, if you upgrade or service this assembly or the .NET Framework, your CLR integration routine may stop working. Please refer SQL Server Books Online for more details.

使用System.DirectoryServices中正确地在SQL Server中注册的,我现在能够部署/注册相关的自定义SQL CLR程序集没有任何问题。

With System.DirectoryServices properly registered in SQL Server I am now able to deploy/register the dependent custom SQL CLR assembly without any problems.

这篇关于如何注册System.DirectoryServices中为SQL CLR用户功能的使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆