是否要安装在GAC在SharePoint EventReceiver有,如果这样做的所有相关组件都呢? [英] Does a SharePoint EventReceiver have to be installed in the GAC, and if so do all dependent assemblies have to as well?

查看:166
本文介绍了是否要安装在GAC在SharePoint EventReceiver有,如果这样做的所有相关组件都呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我公司于一种产品,除其他事项外注册的SharePoint EventReceiver上SPLists,监测变化。我已经将其注册在GAC它运行得很好。然而,我们的一个客户有EX pressed不满被安装在GAC我们的组件,并希望我们能够把我们的二进制文件到SharePoint bin目录,这样做是必需的情况下工作,其它安全/信任巫术。

My company ships a product that among other things registers SharePoint EventReceiver on SPLists, monitoring for changes. I've been registering it in the GAC where it runs just fine. However, one of our customers has expressed unhappiness with our assembly being installed in the GAC and wishes us to move our binaries to the SharePoint BIN directory and do the other security/trust voodoo that is required for that scenario to work.

当我尝试注册事件接收器,是不是在GAC中,我得到了非常具体的异常的消息写道:本次活动接收器组件是不是在GAC我跨preT这包括SharePoint,要求事件接收器安装在GAC中。此外,我发现这个MSDN上:<一href="http://msdn.microsoft.com/en-us/library/ff407965.aspx">http://msdn.microsoft.com/en-us/library/ff407965.aspx:部分事件接收和处理事件的状态

When I try to register an event receiver that is not in the GAC, I get the very specific exception whose message reads: "The event receiver assembly is not in the GAC." I interpret this as SharePoint requiring event receivers to be installed in the GAC. Furthermore, I found this on MSDN: http://msdn.microsoft.com/en-us/library/ff407965.aspx: the section "Event Receivers and Handling Events" states

的SharePoint Foundation事件处理程序   是自定义的编译模块   管理code的调用是   由一个特定的事件触发的那   您指定。事件处理函数code   被编译成一个.dll文件,   部署到GAC。

SharePoint Foundation event handlers are a compiled module of custom managed code whose invocation is triggered by a specified event that you have specified. Event handler code is compiled into a .dll file and deployed to the GAC.

这再次暗示,但并没有完全出状态的GAC安装的要求。是否有人知道这个肯定的答案,这样我就可以回去给客户,并解释我们的GAC要求?

This again implies but does not full-out state that the GAC installation is a requirement. Does someone know the answer for this for certain, so I can go back to the customer and explain our GAC requirement?

的后续问题是现在的:如果我在GAC集会,与我静态链接到其他组件 - 也就是我不显式地使用动态加载的Assembly.Load他们() - 然后将这些其他组件还必须驻留在GAC?

The followup question is now: if I have an assembly in the GAC, and I "statically link" to other assemblies -- i.e. I don't explictly dynamically load them with Assembly.Load() -- then those other assemblies must also reside in the GAC?

推荐答案

事件接收器组件不能只在bin的安装,因为这样一来在.NET Framework无法找到他们。

Event receiver assemblies cannot be installed only in "bin", because this way the .net framework could not find them.

当您的组件由装箱那是因为组件加载器使用探测定位程序集。首先它会在GAC,然后查找目录称为当前工作目录下的bin。

When your assembly is loaded from "bin" it is because assembly loader uses probing to locate the assembly. First it looks in GAC, then looks for directory called "bin" under the current working directory.

因此​​c您用来运行Web界面的所有$ C $ - codebehind的ASPX页面,Web服务等,可以放在的Inetpub .... / bin中,因为Web应用程序的工作目录是存在的

Hence all code you use to run the web interface - codebehind for ASPX pages, web services etc, can be placed in inetpub..../bin because the working directory of your web application is there.

不过,工作流程和计划的计时器作业是由OWSTIMER.exe,这是一个Windows服务运行。作为一个典型的Windows服务,它有它的工作目录中的某个地方C:\ WINDOWS。

However, workflows and scheduled "timer jobs" are executed by the OWSTIMER.exe, which is a Windows Service. As a typical windows service, it has its working directory somewhere in c:\windows.

这意味着,如果你在某处放置组件的Inetpub \ bin中,它会不会被owstimer发现。

It means, if you place your assembly somewhere in inetpub...\bin, it will not be found by the owstimer.

因此​​,像事件处理程序共享的组件已部署到GAC。

Hence, shared assemblies like event handlers have to be deployed to GAC.

这篇关于是否要安装在GAC在SharePoint EventReceiver有,如果这样做的所有相关组件都呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆