5

I added a template using,

STSADM -o addtemplate -filename "C:\Stalker\BaleeeBaleee.stp" -title "YouBreakLive"

I can see it in Central Administration in "Custom" site templates when I try to create a new site collection, but after execution of command it says,

Operation completed successfully.

IIS must be restarted before this change will take effect. To restart IIS, open a command prompt window and type iisreset.

2
  • 1
    Interesting question, always taken that as granted. Will be nice if someone explains the inner workings of it. Commented Dec 19, 2012 at 11:53
  • 1
    Well, the stsadm requested that clearly. You may be more successful asking about the reason in MS Connect forums if no MS employee reads this. Commented Dec 19, 2012 at 12:14

2 Answers 2

4

My guess would be that SharePoint caches the contents of the template store and an IIS reset is required to rebuild that cache to pick up the new template that you just added.

2
  • Caching is what immediately sprang to mind for me as well..
    – Kit Menke
    Commented Dec 19, 2012 at 14:35
  • Yes - it could really be the blob-cache. I have a vague memory of having flushed the blob cache thus the central admin command and avoided the need for an iisreset. Take this with a grain of salt - it may also be my memory playing triks. Commented Dec 20, 2012 at 9:08
3

Yes, it's cache related.

When you execute "addtemplate" from stsadm, the template file is actually saved to the content database. To be specific, it will be added as a custom global web template " SPPersistedCustomWebTemplate" through the SharePoint "SPWebService" object (which is a sort of helper object that helps SharePoint Web Application retrieve and cache data from the content database and also other stuff).

My guess is, since the application pools are already loaded in memory with cached stuff with the help of the SPWebService (application pools are actually associated to this helper service before even being associated to an actual SPWebApplication), an IISRESET guarantees the recycling of the cached objects.

To learn more about how the template is being added, you can reflect against STSADM, and find "SPAddTemplate" class.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.