Monday, September 17, 2012

Service Unavailable – HTTP Error 503. (SharePoint 2010)

When you try to load the page you probably might end up with following error:
Service Unavailable – HTTP Error 503

First Shot

Check Application Pool, most probably it will be turned off. Turn it on and test the portal.

If App Pool shuts down once more than

Second Shot 

Check the eventvwr
I had following error message:(not pasting the whole message but the important pointer)

The exception message is: Exception has been thrown by the target of an invocation.. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: The farm is unavailable. at Microsoft.SharePoint.Administration.Claims.SPSecurityTokenServiceManager.

If your error message is same as mine then try this resolution:

Open Application Pool - > Advanced Settings - > Enable 32 Bit Application and Set to FALSE

Hope that fixes your error.

Have Fun!!!

Tuesday, September 11, 2012

Admin SVC must be running in order to create deployment timer job


This error message pops up when solution is installed using powershell command

Install-SPSolution -identity test.wsp -webapplication http://test/


Method 1:
Go to Administrative Tools > Services and browse to find “Sharepoint 2010 Administration”.
Start  Service

Method 2:
Start-Service SPAdminV4

Error Deploying WSP using Visual Studio 2010


Error occurred in deployment step 'Activate Features': Feature with Id  is not installed in this farm, and cannot be added to this scope.

This is mainly due to inability of Visual Studio 2010 to deploy solution in farm.try deploying the WSP using powershell command in each web front end SharePoint server in farm.

Check this article:

Wednesday, July 11, 2012

Storing values in SharePoint 2010 Property Bag

Property bags?
Property bags are place to store metadata or properties.The property bags are implemented as hash table consisting of property names and values.

Property bags can be defined at following levels:

  • Farm (SPFarm class) 
  • Web application (SPWebApplication class) 
  • Site collection (SPSite class) 
  • Site (SPWeb class) 
  • List (SPList class)

Property bags can be set using SharePoint designer and programmatically.

Using SharePoint Designer 2010:

  • Open Site in SharePoint Designer 2010
  • Go to Site->Site Options
  • Click on Parameters tab where you can see the list of existing properties, from the same place you can even perform add/modify/remove actions.


To Read the Set Key:

SPSite siteCollection = new SPSite("");
SPWeb website = mySite.RootWeb;
string MyValue = website.AllProperties["KeyName"]);

To Set the Value
SPSite siteCollection = new SPSite("  ");
SPWeb website = mySite.RootWeb;
website.Properties.Add(" KeyName ", "KeyValue");

Monday, June 25, 2012

Adding DLL to WSP SharePoint 2010

In order to add custom dll to WSP Package , follow these steps:

  • Create new Empty SharePoint Project 
    • File->New->Project->SharePoint(2010)->Empty SharePoint Project 
    • In second screen provide test site URL
    • Select "Deploy as Farm Solution"

  • Expand package node and double click on Package.package file 

  • Click on "Advanced" Tab

  • Add the Custom dll's using the "Add" button

  • Save the project, compile and deploy. Custom dll will be part of WSP.



Wednesday, June 13, 2012

SharePoint Foundation 2010 Best Practice

Sandbox Solution Capabilities

Complete Article :

In Nutshell

Sandboxed solutions support the following capabilities and elements:

Content Types/Fields

Custom actions

Declarative workflows

Event receivers

Feature callouts

List Definitions

List Instances







Support for all Web Parts that derive from System.Web.UI.WebControls.WebParts.WebPart

Web Parts

WebTemplate feature elements (instead of Webtemp.xml)

Visual Web Parts

Sandboxed solutions do not support the following capabilities and elements:

Application Pages

Custom Action Group

Farm-scoped features

HideCustomAction element

Web Application-scoped features

Workflows with code

Monday, June 11, 2012

Get Machine Name and IP ASP.NET

My previous post has an function which is now deprecated.

Following are the new function to get client machine name and IP address:

string[] computer_name = System.Net.Dns.GetHostEntry(Request.ServerVariables["remote_addr"]).HostName.Split(new Char[] { '.' });
string machineName=computer_name[0].ToString();
string ipAddress  =Request.ServerVariables["REMOTE_ADDR"].ToString();

Wednesday, June 06, 2012

Powershell Commands (Mostly Used)

Here is collection of commonly used powershell cmdlets.
More details :

Add-SPSolution(Uploads a SharePoint solution package to the farm.)
Add-SPSolution -LiteralPath c:\contoso_solution.wsp

Remove-SPSolution(Removes a SharePoint solution from a farm.)
Remove-SPSolution -Identity contoso_solution.wsp

Install-SPSolution(Deploys an installed SharePoint solution in the farm.)
Install-SPSolution -Identity contoso_solution.wsp -GACDeployment

Uninstall-SPFeature(Uninstalls an installed feature definition.)
Uninstall-SPFeature -path "MyCustomFeature"

Add-SPUserSolution(Uploads a new sandboxed solution to the solution gallery.)
Add-SPUserSolution -LiteralPath c:\contoso_solution.wsp -Site http://sitename

Disable-SPFeature(Disables an installed SharePoint Feature at a given scope.)
Disable-SPFeature –identity "MyCustom" -URL http://somesite

Enable-SPFeature(Enables an installed SharePoint Feature at the given scope.)
Enable-SPFeature –identity "MyCustom" -URL http://somesite

Get-SPFeature(Returns the SharePoint Features based on a given scope)
Get-SPSite http://somesite | Get-SPWeb –Limit ALL |%{ Get-SPFeature –Web $_ } | Select DisplayName,ID -Unique

Install-SPFeature(Installs a SharePoint Feature by using the Feature.xml file.)
Install-SPFeature -path "MyCustomFeature"

Uninstall-SPFeature(Uninstalls an installed feature definition)
Uninstall-SPFeature -path "MyCustomFeature"


SharePoint 2010 101 Code Samples

Monday, June 04, 2012

Error while Installing SharePoint Foundation 2010 to Win 7 Desktop

Setup is unable to proceed due to following error(s):
This product required Windows Server 2008 Service pack 2 or above.
Correct the issue(s) listed above and re-run set up.

In Order to install SharePoint 2010 Foundation/Office Server 2010, you need to make changes to configuration settings.

Refer article below:


Friday, June 01, 2012

Deploying SharePoint 2010 Package using VS 2010

Well today i created a solution package and tried to deploy it to SharePoint 2010 portal hosted in separate server.Though it sounds such a straight forward step, i managed to get a nice long error message stating :

Error occurred in deployment step 'Recycle IIS Application Pool': Cannot connect to the SharePoint site. Make sure that this is a valid URL and the SharePoint site is running on the local computer. If you moved this project to a new computer or if the URL of the SharePoint site has changed since you created the project, update the Site URL property of the project

So i was back to my favorite page "". (Not sure what would have been life of a techi if search engines would not had been there ;-) .)

So i came to know that currently Visual Studio 2010 only supports deployment of packages to locally installed SharePoint instance.So no remote support yet.

if you want to deploy to remote server than there are multiple ways to achieve this one :

Error while deploying package using Visual Studio 2010 to SharePoint 2010

Cannot access the local farm. Verify that the local farm is properly configured, currently available, and that you have the appropriate permissions to access the database before trying again.


Error occurred in deployment step 'Recycle IIS Application Pool': The local SharePoint server is not available. Check that the server is running and connected to the SharePoint farm.


The error pops up when userid doesn't have access to configuration and content DB.

There are 2 ways to resolving this issue.

Preferable Method(1st method): 
Use Power shell command to provide user id access to SharePoint DB's.

  • "Add-SPShellAdmin -UserName domain\username" This will add permissions to the config database in SharePoint 2010
  • "Get-SPContentDatabase -WebApplication " This will return information on the content database for the desired web application
  • "Add-SPShellAdmin -UserName domain\username -database " This will add permissions to the content database for the desired web application

2nd method:
Add the userid as DBOwner to Configuration and Content DB. Though this is not best practice but will at least get you going.


Tuesday, May 01, 2012

Unable to display this webpart error when connected to data using BCS services

Well in my case it was a known issue, data throttling. Challenge was not to fix the issue but was to figure out what the issue is .

Generic error like "Webpart error" doesn't help.

1) First issue was to figure out the issue.

Solution :
Use ULS Viewer, it's very handy in such situation :

2) How to throttle the data. This one was a quick one. Pretty good article in this team blog.

-Raghu Iyer

Gray Failures: What is it and how to detect one?

If you are reading this article , i guess you are curious to know about gray failures and different methods to detect gray failures.  Hopefu...