Pages

Tuesday 1 May 2012

SharePoint: Differences Between Global and Web Application Targeted Solution Deployment

SharePoint solutions are either deployed globally or targeted to a particular web application. The decision of which is made automatically by the SharePoint Solution framework depending on the contents of the solution manifest. Certain items in the solution manifest such as SafeControl entries result in modifications to a Web application’s web.config file. Only when a solution manifest does NOT contain any of these types of entries will the solution be globally deployed.


The deployment process behaves differently based on the type of deployment for the solution, and these differences have caused me quite a headache. Here are my findings that I think any SharePoint developer or administrator should be aware of when performing solution deployments.


Globally Deployed Solutions
When a solution is deployed globally, all SharePoint application pools, including Central Administration’s, are recycled automatically. This can be good and bad. This is good because any GAC installed DLL that has been upgraded needs to be reloaded. This can be bad though with regards to the availability of your entire SharePoint Farm.


In my particular case, I am working with a SharePoint administrator to deploy a globally deployed solution that is used by only a single web application. It is fine for this web application to be unavailable, as we have cleared it with our change control process and made announcements of the downtime, but we haven’t announced to users of the other SharePoint web applications in the Farm that their sites will be coming down along with it. So be forwarned.




Web Application Targeted Solutions I have become fond of web application targeted solutions because they offer me a workaround to the above availability problem. When a web application targeted solution is deployed or retracted, only the application pools of the targeted web applications are recycled.


Enterprise Farm Strategies When upgrading solutions, the upgradesolution stsadm command only gets you so far. I’ve found it is best to fully retract and remove the old solution and then add and deploy the new solution in order to be sure your upgraded features actually take.


Avoid the -allcontenturls switch – When deploying and retracting a web application targeted solution, deploy or retract it only to those web applications that will use it … thus preventing unnecessary recycling of application pools. I was being lazy in my retraction script and instead of specifying the particular web application url, I used the -allcontenturls switch to retract my solution, hoping SharePoint would be smart enough to recycle only the application pools of the web applications the solution was actually retracted from. Bad assumption. They all get recycled.




A Big Gotcha that Got Me If you are upgrading a web application targeted solution using the retract, remove, add, deploy strategy mentioned above and your web application scoped Features have associated Feature Receivers, then you must recycle the Central Administration application pool after removing the old solution and before adding the new solution if you intend to use the Central Admin Web application features page to activate your solution’s Features. In this case, it is the Central Administration application pool that executes your web application scoped Feature Receivers, and if not recycled, it will continue to use the loaded cached old versions of assemblies updated by your solution.


The same also goes for powershell. If within a powershell console you deactivate a Feature having a Feature receiver, the assembly containing the Feature receiver will be loaded and cached by the powershell App domain. After retracting, removing, adding, and redeploying the solution in the same powershell console, it will still be the previous version of the assembly that is cached. If you were to attempt to script the activation of your Feature, your updated Feature receiver’s code is never executed, rather the previous version from the cached assembly is used. To get around this dilemma, you can either increment your assembly version or start a new powershell console before deploying and activating your updated solution’s Features.


5 comments:

  1. he decision of which is made automatically by the SharePoint Solution framework depending on the contents of the solution manifest.

    Hey that is a good post & a good set of conversations too. Keep sharing, that is good...

    ReplyDelete
  2. Spot on with this write-up, I truly think this website needs much more consideration. I’ll probably be again to read much more, thanks for that info.

    ReplyDelete
  3. It is very important topics about differences between global and web application targeted solution deployment. It is good stuff

    ReplyDelete
  4. Perfect answer for my search!

    ReplyDelete
  5. Wow, this post is good, my sister is analyzing these kinds of things,
    so I am going to tell her.

    My weblog ... novoline und handy

    ReplyDelete

Popular Posts