Cannot publish pages in SharePoint 2010

ServiceApps
I recently set up a new web application with a site collection where publishing is enabled.
 
After doing the usual post creation checks I found that I was getting an error while trying to submit a page for approval.
 
The error:
 
The form cannot be rendered. This may be due to a misconfiguration of the Microsoft SharePoint Server State Service. For more information, contact your server administrator.
 
Time to use everyone’s favourite decision engine…. after admiring the picture for way to long.
 
So the culprit appears to be the State Service. Now having checked my server does indeed have one… Puzzled I decided to delete it and recreate using the following PowerShell
 
  1. $serviceApp = New-SPStateServiceApplication -Name “State Service”
  2. New-SPStateServiceDatabase -Name “StateServiceDatabase” -ServiceApplication $serviceApp
  3. New-SPStateServiceApplicationProxy -Name “State Service” -ServiceApplication $serviceApp -DefaultProxyGroup

And Bob’s your uncle a brand new State Service springs to life. Brilliant I thought… straight back to my site to try again… but dam the same error showed it’s ugly head.

After pondering throwing myself or the laptop off the balcony it dawned on me that by deleting the service it had probably no longer got an association with the web application. This was indeed the case, so after navigating to the manage web applications page and selecting the service connections I attached the State Service.

All is now well in ‘Publishing Land’ and I can get on with kicking SharePoint just that little bit harder.