SharePoint's OWSTIMER service keeping references to feature receiver assemblies

偶尔善良 提交于 2019-12-11 05:15:11

问题


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?


回答1:


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.




回答2:


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:

SC \\SERVER1 STOP W3SVC
SC \\SERVER1 STOP SPTIMERV4
SC \\SERVER2 STOP W3SVC
SC \\SERVER2 STOP SPTIMERV4

Then restart with the following:

SC \\SERVER1 START SPTIMERV4
SC \\SERVER1 START W3SVC
SC \\SERVER2 START SPTIMERV4
SC \\SERVER2 START W3SVC


来源:https://stackoverflow.com/questions/5047694/sharepoints-owstimer-service-keeping-references-to-feature-receiver-assemblies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!