我试图在SQL中创建程序集,但无法加载以下DLL。
System.ServiceModel.Internals
create assembly [system.servicemodel.internals]
from 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.ServiceModel.Internals.dll'
with permission_set = safe;
go我知道这个错误:
Msg 6218,级别16,状态2,第2行为程序集“System.ServiceModel.Internals”创建程序集失败,因为程序集“System.ServiceModel.Internals”验证失败。检查引用的程序集是否是最新的和可信的(对于external_access或不安全)是否要在数据库中执行。CLR错误消息(如果有的话)将跟随此消息:堆栈上的System.Runtime.IOThreadScheduler+ScheduledOverlapped::.ctoroffset 0x00000023预期的非托管指针意外类型。:System.Runtime.IOThreadScheduler+ScheduledOverlapped::Postoffset 0x0000000D预期的非托管指针在堆栈上的意外类型。:System.Runtime.IOThreadScheduler+ScheduledOverlapped::Cleanupoffset 0x00000019期望值堆栈上的非托管指针意外类型。:System.Runtime.Diagnostics.DiagnosticsEventProvider::WriteMessageEventoffset 0x0000004B需要堆栈上的数字类型。:无法验证System.Runtime.Diagnostics.DiagnosticsEventProvider::WriteEventoffset 0x0000012B指令。:无法验证System.Runtime.Diagnostics.DiagnosticsEventProvider::WriteEventoffset 0x0000003F指令。:System.Runtime.Diagnostics.DiagnosticsEventProvider::WriteEventoffset 0x00000061预期堆栈上的数字类型。:System.Runtime.Diagnostics.DiagnosticsEventProvider::WriteEventoffset 0x00000001堆栈上预期的非托管指针意外类型。:无法验证System.Runtime.Diagnostics.DiagnosticsEventProvider::WriteTransferEventoffset 0x0000007C指令。:System.Runtime.Diagnostics.DiagnosticsEventProvider::WriteTransferEventoffset 0x000002F4堆栈上预期的非托管指针意外类型。[...
我看到这个解决了的问题(几乎100%类似) Failed to CREATE AN ASSEMBLY in SQL,所以我尝试做同样的事情
Server的.NET版本和文件是相同的v4.0.30319

我运行了select * from sys.dm_clr_properties语句,结果似乎是正常的。
directory C:\Windows\Microsoft.NET\Framework64\v4.0.30319\
version v4.0.30319
state CLR is initializedSQL版本: 11.2.5058.0
知道如何创建这个程序集吗?
我需要它,因为当我试图创建一个自定义程序集时,我得到了以下错误:
Assembly 'DataLoader' references assembly 'system.servicemodel.internals, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: 2(The system cannot find the file specified.)). Please load the referenced assembly into the current database and retry your request.
发布于 2015-02-04 21:34:01
是否尝试使用“不安全权限集”选项安装程序集?
我在SQLServer11.0.5058上安装了System.ServiceModel.Internals (来自GAC的v4),因为它不安全,我不知道您是否也会出现版本控制问题,但我相信程序集只能在不安全的情况下安装,因为它可能访问非托管资源。
从您的错误消息:
在堆栈上找到非托管指针意外类型。
我理解这是预期的非托管指针,发现了非托管指针,不允许非托管指针。
有关权限集的定义,请参见https://msdn.microsoft.com/en-us/library/ms189566.aspx。
发布于 2015-02-01 10:07:44
[found ref 'System.String'] Expected numeric type on the stack堆栈跟踪告诉了这个故事,CLR验证器检查了堆栈,发现了一个意想不到的类型,一个字符串而不是一个数字。那太糟了。正在执行的相关方法,堆栈跟踪不完整,所以我们不能一直跟踪它,是System.Runtime.Diagnostics.DiagnosticsEventProvider.WriteTransferEvent().
这是.NET 4在.NET框架中的添加,它支持.NET(事件跟踪for .NET)。反汇编程序可以通过几个层(例如,System.ServiceModel.Channels.HttpRequestContext.TraceHttpMessageReceived()将其称为反汇编程序)显示使用它的代码。
换句话说,我们坚定地站在WCF的土地上,它通过HTTP接收到一条消息,并生成一个ETW事件,因此可以通过ETW工具跟踪它。调用起源于System.ServiceModel.dll,核心WCF程序集,ETW跟踪代码位于System.ServiceModel.Internals.dll中。
因此,考虑到问题的性质,SQL Server机器对这些WCF程序集有两个不同的修订版,这是一个预先确定的结论。它们通常作为一对分发,这是基本.NET安装的一部分。自从Windows4.0RTM之后,版本4.01、4.02、4.03已经有了许多修订,例如,这些更新特别影响到了.NET。更不用说4.5、4.5.1、4.5.2和4.6版本,以及一些修复错误和修补安全问题的KB更新。
期待下一个问题:那么System.ServiceModel.Internals.dll的正确修订是什么呢?你可以打电话给微软支持,他们会告诉你:“没有”。但你已经知道了。所以别这么做。如果您想让这个方法起作用,那么一个基本的策略是首先查看System.ServiceModel的修订号,然后尝试找到一个System.ServiceModel.Internals,如果它的修订号不相等,那么至少在大致上是这样的。您现在拥有的版本几乎肯定是不接近的,版本34234大致上是一个.NET 4.5.2修订号。
https://stackoverflow.com/questions/27816616
复制相似问题