Thursday, July 22, 2010

SharePoint Server State Service

After adding the SharePoint 2010 Chart Web Part to a page I received an error that the Server State Service had not been configured.  Apparently this service is not installed unless you do the simple SharePoint install or use the service setup wizard (which you should never use).  This service application is also used for InfoPath forms services and some of the Visio services which are not set up to use Silverlight.

After reviewing the Central Administration console I soon realized this service application cannot be created in the UI so I lookup up the article to use PowerShell, here it is: http://technet.microsoft.com/en-us/library/ee704548.aspx

To create the service open a SharePoint PowerShell command windows from Start -> Microsoft SharePoint 2010 Products -> SharePoint 2010 Management Shell
Here are the three basic commands you will need to create the service application and associated database.

$serviceApp = New-SPStateServiceApplication -Name "<StateServiceName>"

New-SPStateServiceDatabase -Name "<StateServiceDatabase>" -ServiceApplication $serviceApp

New-SPStateServiceApplicationProxy -Name "<ApplicationProxyName>" -ServiceApplication $serviceApp -DefaultProxyGroup

Also here is a screenshot of the output I received:


After the service was up and running the Chart Web Part started working great.

Tuesday, July 20, 2010

Where did my Collaboration Portal go in SharePoint 2010?

When I went to create my first site collection in SharePoint 2010 I was surprised to find there was no site template for the Collaboration Portal.  Apparently it is still there but not on the list of site templates.  If you would like to use the template you will need to create the site using PowerShell.  Below is the command to create a site collection using the Collaboration Portal template.

New-SPSite -Url http://<url of Site> -OwnerAlias <domain>\<user> -Name “The Wils” -Template SPSPORTAL#0

Sources:
http://technicallead.wordpress.com/2010/05/11/create-collaboration-portal-using-powershell/ (Where I discovered this information)

http://www.toddbaginski.com/blog/archive/2009/11/20/which-sharepoint-2010-site-template-is-right-for-me.aspx(A great article on choosing what site template is best for you and also what the site template IDs are for your PowerShell scripts)

Friday, July 9, 2010

PowerShell Script for Delete SharePoint Designer Cache

I have developed several workflow activities for use within SharePoint designer.  Every time a SharePoint Designer workflow is opened a copy of the deployed DLL is downloaded into the WebSiteCache folder in the user profile.  If the DLL is redeployed and the cache is not cleared out errors will be detected when attempting to re-save the workflow.  In order to fix this I have created a simple PowerShell script that will determine the location of the cache directory and delete it.  It will also detect if SharePoint designer is currently running.  It is required that Designer be closed in order to delete the cache directory.

# This script will determine the current user and delete the
# WebSiteCache folder which hold temporary data used by SharePoint
# Designer.

if(Get-Process 'SPDESIGN' -ea SilentlyContinue)
{
    "Please close SharePoint Designer before running this script."
}
else
{
    $username = $env:USERNAME
    if (Test-Path C:\Users\$username\AppData\Local\Microsoft\WebsiteCache)
    {
        "Directory Exists Removing Contents for $username"
        Remove-Item C:\Users\$username\AppData\Local\Microsoft\WebsiteCache -force -recurse
        "Done."
    }
    else
    {
        "Directory Does Not Exist for $username"
    }
}

Thursday, July 8, 2010

Remove Timeout When Debugging w3wp Process

One of the smart guys I work with posted some information about debugging the W3WP process that I though I should share. Many times when debugging this process I get timeout errors when I let it sit for too long.

Error: The web server process that was being debugged has been terminated by Internet Information Services (IIS)

You can get rid of the timeout by following the following directions. Caution, this should only be done on development boxes, do not change these settings on your production machines.

  1. Open the Administrative Tools window.
  2. Click Start and then choose Control Panel.
  3. In Control Panel, choose Switch to Classic View, if necessary, and then double-click Administrative Tools.
  4. In the Administrative Tools window, double-click Internet Information Services (IIS) Manager.
  5. In the Internet Information Services (IIS) Manager window, expand the node.
  6. Under the node, right-click Application Pools.
  7. In the Application Pools list, right-click the name of the pool your application runs in, and then click Advanced Settings.
  8. In the Advanced Settings dialog box, locate the Process Model section and chose one of the following actions:
    • Set Ping Enabled to False. —or—
    • Set Ping Maximum Response Time to a value greater than 90 seconds.
  9. Setting Ping Enabled to False stops IIS from checking whether the worker process is still running and keeps the worker process alive until you stop your debugged process. Setting Ping Maximum Response Time to a large value allows IIS to continue monitoring the worker process.
  10. Click OK.

Thursday, July 1, 2010

SharePoint Kerberos Authentication wtih IIS 7+

When Microsoft designed IIS 7 they decided to add in a new feature that automaticaly uses the LocalSystem account for Windows Authentication by the kernel.  The problem with this is that is causes problems when a domain account is being used for the SharePoint applicaiton pools and Kerberos is enabled.  Because the authenication is happening as LocalSystem the application pool account is desregarded when it comes to kerberos.

Symptom(s):
When I had kerberos enabled and the kernel-mode authentication was enabledI would get prompted for user credentials until finally receiving a 401 error in the browser.

Fix(s):

There are two ways to fix this issue.  You can fix it for all websites or for a specific website.  The first solution is to apply to all websites.

Apply to all sites:
Right click on Notepad and choose "Run as administrator"

Navigate to and open: C:\Windows\System32\inetsrv\config\applicationHost.config

Under the system.webServer/security/authentication/windowsAuthentication section ensure the following.

<windowsauthentication enabled="true" useapppoolcredentials="true" usekernelmode="true">

Apply to individual site:
The second way will allow you to apply this change to a specific website.

Open the IIS Manager and click on the website you would like to change.  Then double click on the Authentication icon in the center pane.


Click on the Windows Authentication option in the center pane and then click Advanced Settings... in the right hand pane.


Finally un-check the Enable Kernel-mode authentication box.


Supporting Post(s):



Microsoft Forefront Client Install Wihtout Centralized Server

I was recently looking around for an Anti-Virus solution for Windows Server 2008.  I had tried downloading Microsoft Forefront Client before but when I ran the setup it wanted me to install a ton of server components... so where is the client part of all this?  What I wanted was a simple anti-virus software that uses windows update to get all my new virus definitions.

To do this just run the install the client from the cd using the /NOMOM switch.  This install the client but uses Windows Update to get all the virus definitions.

Open a Command Prompt using the "Run as administrator" option.  Then run one of the following commands based upon your server OS being 32 or 64 bit.

32-bit

[CD]:\CLIENT\CLIENTSETUP.EXE /NOMOM

64-bit
[CD]:\CLIENT\X64\CLIENTSETUP.EXE /NOMOM