为什么无法在 SQL Server 2008 中注册 System.Web?
运行此命令:
CREATE ASSEMBLY
[System.Web] from
'C:\Windows\Microsoft.NET\Framework\v2.0.50727\system.web.dll'
with permission_set = UNSAFE
给我这个错误:
消息 10300,级别 16,状态 2,第 1 行
程序集“System.Web”引用程序集“system.web,version=2.0.0.0,culture=neutral,publickeytoken=b03f5f7f11d50a3a。”,该程序集不存在于当前数据库中。 SQL Server 尝试从引用程序集的来源位置查找并自动加载引用的程序集,但该操作失败(原因:版本、区域性或公钥不匹配)。请将引用的程序集加载到当前数据库中,然后重试您的请求。
……这听起来有点傻。 SQL Server 似乎认为 System.Web 程序集正在引用它自身。我该如何解决这个问题?
Running this command:
CREATE ASSEMBLY
[System.Web] from
'C:\Windows\Microsoft.NET\Framework\v2.0.50727\system.web.dll'
with permission_set = UNSAFE
Gives me this error:
Msg 10300, Level 16, State 2, Line 1
Assembly 'System.Web' references assembly 'system.web, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.', 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: version, culture or public key mismatch). Please load the referenced assembly into the current database and retry your request.
... this sounds a little silly. It seems like SQL Server thinks that the System.Web assembly is referencing it's self. How can I fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试使用 Framework64 程序集(64 位 sql server 2008)
创建程序集
从
'C:\Windows\Microsoft.NET\Framework64\v2.0.50727\System.Web.dll' [System.Web]
与permission_set = UNSAFE
GO
Try with Framework64 assemblies (64 bit sql server 2008)
CREATE ASSEMBLY
[System.Web] from
'C:\Windows\Microsoft.NET\Framework64\v2.0.50727\System.Web.dll'
with permission_set = UNSAFE
GO
听起来您需要在数据库服务器上安装.Net 2.0 框架。
另外,我不会直接添加对 System.Web.dll 的引用。您的其他自定义 CLR 代码应该引用该代码。 (或者,如果您没有自定义 .Net 代码,则应创建一个自定义 .Net 项目以连接到 System.Web 程序集。)
It sounds like you need to install the .Net 2.0 framework on your database server.
Also, I wouldn't directly add a reference to System.Web.dll. Your other custom CLR code should reference that. (Or, if you don't have custom .Net code, you should create a custom .Net project to interface into the System.Web assembly.)
结果 System.web.dll 不受支持。事实上,事实证明,像这样将 DLL(对于 CLR)加载到 SQL Server 中在很多层面上都是一个坏主意(其中之一是部署之间的 64/32 位支持)。
Turns out System.web.dll isn't supported for this. In fact, it turned out that loading DLLs into SQL Server like this (for CLR) was a bad idea on many levels (one of which was 64/32-bit support between deployments).