SharePoint 的 OWSTIMER 服务保留对功能接收器程序集的引用
通过 SharePoint,您可以使用功能接收器在功能出现时执行一些操作已安装/卸载等。
功能接收器从 OWSTIMER 服务运行,该过程似乎大致如下。
- .wsp(一个 cab 文件)被解压并检查。
- .dll 被移动到 bin/gac
- 清单中标记的功能接收器被调用(可以服务仅在 GAC 中)
但是 OWSTIMER 在包含功能接收器的 dll 上保持打开的句柄。
这意味着当您卸载该功能时,Fusion 会将 dll 移至 c:\windows\temp\ 目录,并仍保留引用。 (更多详细信息此处和< a href="http://blogs.msdn.com/b/junfeng/archive/2006/11/17/gac-temp-and-tmp.aspx" rel="nofollow">此处)
当您然后尝试安装新版本(程序集文件版本不同,但程序集版本必须保持相同) OWSTIMER 将运行旧功能接收器。
您可以通过重新启动 OWSTIMER 服务来阻止这种情况发生,但这在可能有许多 Web 服务器的生产场环境中并不实用。
有人知道任何解决方法吗?
With SharePoint you can use a Feature Receiver to perform some actions when a feature is installed/uninstalled etc.
The feature receiver is ran from the OWSTIMER service and the process seems to be roughly
- .wsp (a cab file) is unpacked and examined
- .dll's are moved to bin/gac
- feature receivers marked in manifest are called (can only be in GAC) by the service
However OWSTIMER keeps a handle open on the dll containing the feature receiver.
This means that when you uninstall the feature Fusion will move the dll to the c:\windows\temp\ directory and still keep the reference. (More details here and here)
When you then try and install the new version (assembly file version different but assembly version has to remain the same) OWSTIMER will run the OLD feature receiver.
You can stop this occurring with a restart of the OWSTIMER service but this is not practical on a production farm environment where there may be many web servers.
Anyone know of any workarounds?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在交换功能之间执行 iisreset。
是的,会关闭所有网络应用程序,但这就是您计划中断/在非工作时间执行此操作的原因。并确保该过程在您的开发机器上经过充分演练。
Do an iisreset between swapping over features.
Yes, brings down all the web apps but that's why you have planned outages / do it out of hours. And make sure the process is well rehearsed on your dev machines.
没有解决方法,但在拥有许多服务器的生产环境中,您不应该从 GAC 手动对 DLL 进行 GAC 处理和取消 GAC 处理。
如果您通过功能架构进行部署,SharePoint 将自动处理此问题。
也就是说,如果您需要在场中的多个服务器之间同步 Windows 服务(包括 OWSTIMER 和 IIS)的启动/停止,只需编写要使用的批处理脚本即可:
然后使用以下命令重新启动:
There are no workarounds, but on a production environment where you have many servers, you should not be manually GAC-ing and un-GAC-ing DLLs from the GAC.
If you deploy via the feature architecture, SharePoint will automatically take care of this.
That said, if you need to synchronize the start/stop of Windows services (including OWSTIMER and IIS) across multiple servers in a farm, it's as simple as writing a batch script to use:
Then restart with the following: