无法通过 PowerShell 使用功能接收器启用功能
我遇到了一个问题,我可以通过站点设置启用 UI 功能,并且一切都按预期工作,但是如果我尝试通过 Sharepoint powershell 启用该功能(我们正在将其作为脚本部署的一部分),我得到下列:
Enable-SPFeature:创建失败 来自程序集“xxxxx”的接收者对象, 版本=1.0.0.0,文化=中立, 公钥令牌 = 967e6960f5af91e6 ", 类“xxxxx.EventReceiver”用于 功能“xxxxx.Public.Search”(ID: 026d7c45-a359-4550-822d-1a6c35e58e0 d).: System.ArgumentNullException: 值不能为空。参数名称: 类型
有谁知道为什么会发生这种情况,或者我应该检查一些事情 功能定义绝对是正确的(因为通过 UI 部署它可以按预期工作,而且我还仔细检查了 PublicKeyToken 是否正确等),并且重新启动服务和 iisreset 也不能让我使用 Enable-SPFeature。
I've got a problem where I can enable a feature the UI and everything works as expected through site settings, but if I try and enable the feature via the Sharepoint powershell (which we are doing as part of a scripted deployment), I get the following:
Enable-SPFeature : Failed to create
receiver object from assembly "xxxxx,
Version=1.0.0.0, Culture=neutral,
PublicKeyToken=967e6960f5af91e6 ",
class "xxxxx.EventReceiver" for
feature "xxxxx.Public.Search" (ID:
026d7c45-a359-4550-822d-1a6c35e58e0
d).: System.ArgumentNullException:
Value cannot be null. Parameter name:
type
Does anyone know why this would occur, or some things I should check? The feature definition is definitely correct (since deploying it through the UI works as expected, and I've also double checked the PublicKeyToken is correct etc etc), and restarting the services and iisreset doesn't enable me to use Enable-SPFeature either.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我有同样的问题。奇怪的是,当您打开一个新的 SP2010 powershell 窗口并重新发出相同的命令时,发现程序集没有任何问题。看:
http://khurramdotnet.blogspot.com/2011/01/enable-spfeature-command-投掷.html
I have the same issue. The curious thing is when you open up a new SP2010 powershell window and reissue the same command the assembly is found without any problems. See:
http://khurramdotnet.blogspot.com/2011/01/enable-spfeature-command-throwing.html
试试这个:转到控制面板,单击“程序”,单击“程序和功能”,选择“Microsoft SharePoint Server 2010”(或您已安装的任何内容),单击“更改”,选择“修复”,然后单击“继续”。这对我有帮助。
Try this: go to the Control Panel, click on "Programs", click on "Programs and Features", select "Microsoft SharePoint Server 2010" (or whatever you have installed), click "Change", select "Repair" and click "Continue". This is what helped me.
试试这个:http://geoffwebbercross.blogspot。 ca/2011/06/failed-to-create-receiver-object-from.html
它对我有用,我不需要改变我的代码/解决方案中的一针一线
Try this: http://geoffwebbercross.blogspot.ca/2011/06/failed-to-create-receiver-object-from.html
It worked for me, I did not have to change a stitch in my code / solution
我昨天遇到了这个,结果发现功能名称和功能接收器名称不匹配。为了解决这个问题,我将 FeatureActivated 代码复制到记事本(整个代码块)或您编码的任何事件中。
已经写了即
FeatureActivated 方法(包括
签名)
从你的项目中。
收到您的项目(您可以
仔细检查名称是否有更改)
事件接收器。
我使用以下代码使用powershell进行部署
I had this yesterday, turns out the feature name and the feature receiver name werent matching. To resolve it I copied the FeatureActivated code into notepad (entire code block) or whichever events it is you have coded.
have written I.e. the
FeatureActivated method (including
signature)
from your project.
received to your project (you can
double check the name for changes)
event receiver.
I use the following code to deploy using powershell
不要使用“普通”PowerShell,而应使用 SharePoint 2010 Management Shell。
Don't use the "normal" PowerShell, use the SharePoint 2010 Management Shell instead.