[英]unable to deploy sql clr stored procedure (unable to verify metadata)
I am trying to run the CREATE ASSEMBLY command for a SQL CLR (.Net 3.5) assembly on SQL Server 2008. It returns a cryptic error message: 我试图在SQL Server 2008上为SQL CLR(.Net 3.5)程序集运行CREATE ASSEMBLY命令。它返回一个隐秘的错误消息:
An error occurred while gathering metadata from assembly 'My.Awesome.Assembly' with HRESULT 0x80004005.
Why is it doing this, and how can I fix it without deploying it as UNSAFE? 为什么这样做,如何在不将其部署为UNSAFE的情况下进行修复?
steps I have done: 我已经完成的步骤:
This is what solved the problem for me; 这就是为我解决问题的原因。 for future reference to anyone out there, SQL CLR stuff is very, very picky. 为了将来供任何人参考,SQL CLR的内容非常挑剔。
I had a constructor like this: 我有一个像这样的构造函数:
public MyObject(IEnumerable<T> items)
{
_innerItems = items.ToDictionary(i => i.Key);
}
I changed it to this: 我将其更改为:
public MyObject(IEnumerable<T> items)
{
_innerItems = new Dictionary<int, T>();
foreach (var item in items)
{
_innerItems.Add(item.Key, item);
}
}
And it was then able to deploy. 然后就可以部署了。 I then proceeded to pound my head against my desk. 然后我继续把头撞在桌子上。 Two methods, functionally equivalent; 两种方法,功能上等效; one works, and one has a cryptic deployment error message. 一种有效,一种具有神秘的部署错误消息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.