Monday 18 February 2013

SharePoint 2010 Chart web part raising error

While adding SharePoint web part, its raising error. After surfing google I found solution here 
The blog is showing that I need to Enable State Service in central admin.
Before moving further, I need to tell you that

The State Service is a shared service that is used by some Microsoft SharePoint Server 2010 components to store temporary data across related HTTP requests in a SQL Server database. In SharePoint Server 2010, the State Service is required by InfoPath Forms Services (including out of the box and custom workflow forms), the SharePoint Server 2010 Chart Web Part, and certain Microsoft Visio 2010 scenarios that do not use Microsoft Silverlight 3.

Now if you have central admin permission, then you can follow the below steps.

1. Go to "Application Management" --> "Manage service applications"
2. Check whether the "State Service" is enabled or not (like the below screenshot). 

















3. If the service is not started or missed, we should configure/start the state service. OK. How to start the service?  proceed with step 4.
4. Go to the "Configuration Wizard" and start the configuration
5. Make sure the "State Service" is enabled. 
6.Wait until you see the below screen (It will take few minutes to complete).













7. Now, check whether the Chart control are rendering properly in the browser or not. If everything is fine, then continue with your work.. Again if you are getting the same error screen, you need to check the "Service Associations" for your current web application (proceed with step 8).

8. In "Central Administration", Go to "Application Management" and select the "Configure service application associations" in "Service Applications" section. 

9. Click on your web application and a pop up windows will be displayed






















10. Select the "State Service" Check box and click "OK".  

If you do not have permission, Or you do not want to configuration wizard(Like me), Then you can use powershell command as below:


$ErrorActionPreference = "Stop"


Add-PSSnapin Microsoft.SharePoint.PowerShell -EA 0

If you are using SharePoint SharePoint 2010 Management Shell then above two lines are not required.



function ConfigureStateService(
    [string] $stateServiceName = $(Throw "Value cannot be null: stateServiceName"),
    [string] $stateServiceDatabaseName =
        $(Throw "Value cannot be null: stateServiceDatabaseName"))
{
    Write-Host "Configuring the State Service..."

    Write-Debug "stateServiceName: $stateServiceName"
    Write-Debug "stateServiceDatabaseName: $stateServiceDatabaseName"

    $serviceApp = Get-SPStateServiceApplication -Identity "$stateServiceName" `
        -Debug:$false -EA 0

    If ($serviceApp -ne $null)
    {        
        Write-Host "The State Service has already been configured."
        return
    }
    
    $database = New-SPStateServiceDatabase -Name $stateServiceDatabaseName `
        -Debug:$false
    $serviceApp = New-SPStateServiceApplication -Name $stateServiceName `
        -Database $database -Debug:$false
    New-SPStateServiceApplicationProxy -ServiceApplication $serviceApp `
        -Name $stateServiceName -DefaultProxyGroup -Debug:$false > $null

Write-Host -Fore Green "Successfully configured the State Service."
}

function Main()
{
    $stateServiceName = "State Service"
    $stateServiceDatabaseName = "StateService"

    ConfigureStateService $stateServiceName $stateServiceDatabaseName
}

Main

And its done.

No comments :

Post a Comment