无法部署sql clr存储过程(无法验证元数据)

发布于 2024-10-06 11:13:39 字数 502 浏览 0 评论 0原文

我正在尝试在 SQL Server 2008 上为 SQL CLR (.Net 3.5) 程序集运行 CREATE ASSEMBLY 命令。它返回一条神秘的错误消息:

An error occurred while gathering metadata from assembly 'My.Awesome.Assembly' with HRESULT 0x80004005.

为什么要这样做,以及如何修复它而不将其部署为不安全?


我已完成的步骤:

  1. 遵循 http://msdn.microsoft.com/ 中的所有规则en-us/library/ms403273.aspx
  2. 未使用静态字段
  3. 已经创建了另外 2 个部署得很好的 SQL CLR 程序集

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:

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?


steps I have done:

  1. Followed all rules in http://msdn.microsoft.com/en-us/library/ms403273.aspx
  2. Used no static fields
  3. Have created 2 other SQL CLR assemblies that deploy just fine

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

合久必婚 2024-10-13 11:13:39

这就是为我解决了问题的原因;为了供将来任何人参考,SQL CLR 的内容非常非常挑剔。

我有一个这样的构造函数:

public MyObject(IEnumerable<T>  items)
{
    _innerItems = items.ToDictionary(i => i.Key);
}

我将其更改为:

public MyObject(IEnumerable<T>  items)
{
    _innerItems = new Dictionary<int, T>();
    foreach (var item in items)
    {
        _innerItems.Add(item.Key, item);
    }
}

然后它就可以部署了。然后我开始用头撞桌子。两种方法,功能等效;一种可以工作,另一种则显示神秘的部署错误消息。

This is what solved the problem for me; for future reference to anyone out there, SQL CLR stuff is very, very picky.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文