Freigeben über


Self-Service Site Creation Announcements keep showing up

Self-Service Site Creation is a feature that lets end users create new site collections without the need to access Central Administration.  You turn it on for the Web Application, and when you do, an Announcement is added to the first Announcements list that is found in the root site collection.  The announcement looks like:

image

You get a new announcement each time Self-Service Site Creation is enabled.  The following would be the expected ways this announcement would show up:

The problem we were running into, is that the announcements kept showing up randomly in the middle of the night.  Sometimes up to 5 – 6 new announcements in a given night.  The customer had a workflow that they wanted people to use to create site collections and get approval, so they didn’t actually want the end users browsing the link in the announcement directly.

We searched all their source code and no one was setting the SPWebApplication property.  The time window was too large to gather process monitor to check for any console applications running.  The IIS logs ruled out the Central Admin settings.  We ended up using the approach from a previous blog post in which we used an Event Receiver on the announcements list to capture a memory dump when the announcement was created.  This way we could catch the process and stack that was giving us grief.

This resulted in memory dumps of the StsAdm.exe process.  The interesting thing is that the person was not running the EnableSSC command, they were actually running SetProperty.  The stack is below with the addresses and parameters removed to clean it up:

Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem
Microsoft.SharePoint.SPListItem.AddOrUpdateItem
Microsoft.SharePoint.SPListItem.UpdateInternal
Microsoft.SharePoint.SPListItem.Update

Microsoft.SharePoint.SPWeb.AddSscAnnouncement Microsoft.SharePoint.Administration.SPWebApplication.set_SelfServiceSiteCreationEnabled Microsoft.SharePoint.Administration.SPBackwardCompatibilityPropertyMapper.SetVirtualServerProperty
Microsoft.SharePoint.Administration.SPBackwardCompatibilityPropertyMapper.UpdateVirtualServerProperties
Microsoft.SharePoint.Administration.SPWebApplicationPropertyBagger.UpdateProperties
Microsoft.SharePoint.Administration.SPVirtualServerConfig+SPVirtualServerPropertyBagger.UpdateProperties
Microsoft.SharePoint.Utilities.SPPropertyBag.Update
Microsoft.SharePoint.StsAdmin.SPSetProperty.Run
Microsoft.SharePoint.StsAdmin.SPStsAdmin.RunOperation
Microsoft.SharePoint.StsAdmin.SPStsAdmin.Main

From the stack, you can see that SetProperty was the operation used with StsAdm.exe, and this led to a call to set_SelfServiceSiteCreationEnabled.  This is the setter of the property mentioned above.  The setter of the property calls AddSscAnnouncement, which is the function that actually adds the announcement.

From here I was able to consistently reproduce the problem and get a feel for what was going on.  Running StsAdm.exe –o SetProperty, sets a property in the SPWebApplication’s PropertyBag.  There’s not a check to see what specific property is being set, and call the setter for that property, so they reapply all the properties in the PropertyBag.  With Self-Service Site Creation enabled, this results in this property being re-enabled each time.  This results in the announcement. 

The only workarounds that we found: