在SQL Server CLR汇编中使用Microsoft Solver Foundation
本文关键字:Microsoft Solver Foundation SQL Server CLR 汇编 | 更新日期: 2023-09-27 17:51:02
我目前正在编写自己的CLR存储过程,我需要使用Microsoft solver Foundation的求解器。
为了能够在我的CLR项目中添加对microsoft Solver Foundation的引用,我需要将该程序集添加到我的SQL Server实例(源)。所以我安装了MS Solver Foundation Redistributable,并使用以下脚本在SQL Server中注册为服务器管理员:
USE MYDB
ALTER DATABASE MYDB SET TRUSTWORTHY ON WITH ROLLBACK IMMEDIATE
ALTER DATABASE MYDB SET TRUSTWORTHY ON
CREATE ASSEMBLY MicrosoftSolverFoundation
AUTHORIZATION dbo
FROM 'C:'Program Files (x86)'Reference Assemblies'Microsoft'Framework'.NETFramework'v4.0'Microsoft.Solver.Foundation.dll'
WITH PERMISSION_SET = UNSAFE
但是,我得到以下错误:
Assembly 'MicrosoftSolverFoundation' could not be installed because existing policy would keep it from being used.
附加信息
CLR版本:
directory C:'Windows'Microsoft.NET'Framework64'v4.0.30319'
version v4.0.30319
state CLR is initialized
SQL Server Version:
Microsoft SQL Server 2012 (SP1) - 11.0.3128.0 (X64)
Dec 28 2012 20:23:12
Copyright (c) Microsoft Corporation
Enterprise Edition: Core-based Licensing (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)
这个MSDN帖子似乎在谈论同样的事情,并建议使用mscorcfg。查看运行时安全策略。
它还提到了Fusion Log Viewer,以查看在您尝试创建程序集时是否记录了任何内容。
https://social.msdn.microsoft.com/forums/sqlserver/en us/6546340a - 2 cf7 - 4308 - 88 - d0 c403cebdb66b/create -装配-错误- - - - - - -不可以安装