Error provisioning the state service application

Jul 10, 2012 at 8:35 PM

I am using AutoSpInstaller v3 and having a problem at "New-SPStateServiceDatabase"

Following is what I have in the configuration file. Server name is correct, SQL alias exists.

Please let me know what am I missing here, Thanks in advance.

<StateService Provision="DEVSHPAPP01"
                      Name="State Service"
                      ProxyName="State Service">
            <!-- You can specify a different DB server/instance or alias per web application and service application. The behavior is slightly different than with the farm DB server though, see below. -->
            <Database>
                <!-- <Name> designates the suffix portion of the database name. For example if your DBPrefix (above) was "SPFarm", and the name below was "ServiceApp", your full DB name would be "SharePoint_ServiceApp" -->
                <Name>StateService</Name>
                <!-- If you are creating an alias (recommended!), <DBServer> is actually the value of the SQL alias; otherwise it's the NetBIOS name of the SQL server or instance. 
                     If you leave <DBServer> blank, the default DBServer value for the farm is used -->
                <DBServer>SPSQLDEVSTATESERVICE</DBServer>
                <!-- The script can create a SQL alias for you. Enter the DBInstance, and if you leave <DBPort> blank, script will assume default port value of 1433 -->
                <DBAlias Create="true"
                         DBInstance="DEVSHPSQL01"
                         DBPort="" />
            </Database>
        </StateService>

 Following is the exception text.

 - Provisioning State Service Application...
New-SPStateServiceDatabase : Operation is not valid due to the current state of
 the object.
At D:\SP2010\AutoSPInstaller\AutoSPInstallerFunctions.ps1:2284 char:31
+                 New-SPStateServiceDatabase <<<<  -DatabaseServer $DBServer -N
ame $StateServiceDB | Out-Null
    + CategoryInfo          : InvalidData: (Microsoft.Offic...eDatabaseCmdlet:
   NewStateServiceDatabaseCmdlet) [New-SPStateServiceDatabase], InvalidOperat
  ionException
    + FullyQualifiedErrorId : Microsoft.Office.Server.Administration.NewStateS
   erviceDatabaseCmdlet

New-SPStateServiceApplication : The pipeline has been stopped.
At D:\SP2010\AutoSPInstaller\AutoSPInstallerFunctions.ps1:2285 char:34
+                 New-SPStateServiceApplication <<<<  -Name $StateServiceName -
Database $StateServiceDB | Out-Null
    + CategoryInfo          : InvalidData: (Microsoft.Offic...plicationCmdlet:
   NewStateServiceApplicationCmdlet) [New-SPStateServiceApplication], Pipelin
  eStoppedException
    + FullyQualifiedErrorId : Microsoft.Office.Server.Administration.NewStateS
   erviceApplicationCmdlet

New-SPStateServiceApplication : The specified object was not found.
Parameter name: Database
At D:\SP2010\AutoSPInstaller\AutoSPInstallerFunctions.ps1:2285 char:34
+                 New-SPStateServiceApplication <<<<  -Name $StateServiceName -
Database $StateServiceDB | Out-Null
    + CategoryInfo          : InvalidArgument: (Microsoft.Offic...plicationCmd
   let:NewStateServiceApplicationCmdlet) [New-SPStateServiceApplication], Arg
  umentException
    + FullyQualifiedErrorId : Microsoft.Office.Server.Administration.NewStateS
   erviceApplicationCmdlet

--------------------------------------------------------------
 - Script aborted!
 - Error provisioning the state service application

 

Jul 10, 2012 at 11:28 PM

I found the problem in the config file, New-SPStateServiceDatabase will not take SQL alias as a parameter. The following configuration worked for me.

<StateService Provision="DEVSHPAPP01"
                      Name="State Service"
                      ProxyName="State Service">
            <!-- You can specify a different DB server/instance or alias per web application and service application. The behavior is slightly different than with the farm DB server though, see below. -->
            <Database>
                <!-- <Name> designates the suffix portion of the database name. For example if your DBPrefix (above) was "SPFarm", and the name below was "ServiceApp", your full DB name would be "SharePoint_ServiceApp" -->
                <Name>StateService</Name>
                <!-- If you are creating an alias (recommended!), <DBServer> is actually the value of the SQL alias; otherwise it's the NetBIOS name of the SQL server or instance. 
                     If you leave <DBServer> blank, the default DBServer value for the farm is used -->
                <DBServer></DBServer>
                <!-- The script can create a SQL alias for you. Enter the DBInstance, and if you leave <DBPort> blank, script will assume default port value of 1433 -->
                <DBAlias Create="false"
                         DBInstance="DEVSHPSQL01"
                         DBPort="" />
            </Database>
        </StateService>

Jul 10, 2012 at 11:32 PM

For more info see the below link

http://technet.microsoft.com/en-us/library/ff607677.aspx

 

Jul 12, 2012 at 11:10 AM

I am getting this error whenever the configuration requires that the New-SPStateServiceDatabase cmdlet has the -DatabaseServer option specified, regardless of whether the value of that parameter is a SQL Alias or not.

My default database server is a SQL Alias and if I run:

New-SPStateServiceDatabase -Name "MyDatabaseName"

It successfully creates a database on my default SQL server using the SQL alias. However, all of the following fail with the error in the original post:

New-SPStateServiceDatabase -Name "MyDatabaseName" -DatabaseServer "MyRealNetBiosSQLHostname"

New-SPStateServiceDatabase -Name "MyDatabaseName" -DatabaseServer "MyRealDNSHostname"

New-SPStateServiceDatabase -Name "MyDatabaseName" -DatabaseServer "MySqlAlias"

 

 

 

 

Coordinator
Jul 12, 2012 at 1:18 PM

So, are we to infer from this that the State Service must always use the default database server for the farm?

Brian

Mar 27, 2013 at 1:48 PM
Edited Mar 27, 2013 at 1:50 PM
You can use Mount-SPStateDatabase instead of New, when you want to use a precreated database for State Service.

Write-Host -ForegroundColor White " - Provisioning State Service Application..."
#Comment out when using a precreated State Service Database Use Mount-SPStateServiceDatabase instead 
#New-SPStateServiceDatabase -DatabaseServer $dbServer -Name $stateServiceDB | Out-Null
Mount-SPStateServiceDatabase -Name $stateServiceDB | Out-Null
New-SPStateServiceApplication -Name $stateServiceName -Database $stateServiceDB | Out-Null
Get-SPStateServiceDatabase | Initialize-SPStateServiceDatabase | Out-Null
Write-Host -ForegroundColor White " - Creating State Service Application Proxy..."
Get-SPStateServiceApplication | New-SPStateServiceApplicationProxy -Name $stateServiceProxyName -DefaultProxyGroup | Out-Null
Write-Host -ForegroundColor White " - Done creating State Service Application."
May 23, 2013 at 10:11 PM
FWIW .. to get around this error you can supply the same alias used when provisioning the farm. Farm.Database.DBServer value in the xml. Brian appears to be correct.