First of all, happy new year to all my readers.
Today a colleague of mine deployed a SharePoint project that required using an InfoPath form. However when the user tried to view the InfoPath form in the browser an error message appeared on the screen saying:
“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.”
If you check in Central Administration you will find in Application Management -> Manage service applications that there is no State Service or State Service Proxy. You cannot create a State Service in the GUI, well you can, but you have to use the Configuration Wizard, which means you have no control over setting it up. Therefore the only option you have left is PowerShell.
Save the following PowerShell script as a ps1 file and then run it.
Add-PSSnapin Microsoft.SharePoint.PowerShell –ErrorAction SilentlyContinue $server = Read-Host "Enter SQL Server" $dbname = Read-Host "Enter Database Name" $SPState_Service = "State Service Application" $SPState_Service_Proxy = "State Service Application Proxy" Write-host "Creating $SPState_Service..." new-spstateservicedatabase -name $dbname new-spstateserviceapplication -name $SPState_Service -Database $dbname new-spstateserviceapplicationproxy -serviceapplication $SPState_Service -name $SPState_Service_Proxy –defaultproxygroup write-host "New $SPState_Service Task Complete"
When you run the above PowerShell, you are able to enter the SQL Server and the Database Name of the service. You could configure the script further to allow the user running the PowerShell script to give the service a custom name.