SharePoint Best Practices : Part 1

Create SQL Server Alias in SharePoint Farm

Recently we ran in to a problem, where our production application suddenly started throwing 502 errors due to performance degradation. After analyzing few things, we suspect that our database server has some problems. As this was a production server and we didn’t want to keep this problem for a long time, so we decided to create a new instance of production database server parallel and we were lucky that we used the SharePoint best practice of creating SQL Server alias. After copying the databases to new server, it took only 5 minutes to point all the WFEs and App servers to new database server.

Right time to set up a SQL Server Alias: After installing the SQL Server and before installing SharePoint on the farm.

Why we need a SQL Server Alias: This should be the number 1 best practice during a SharePoint farm setup. Consider the scenario, One fine day database server gets crashed or faulty and there is no way to recover it or its time-consuming to recover the server and you don’t want your business site go down for a while.

When we install SharePoint on a farm, during SharePoint_Config database creation, the wizard asks for SQL Server name/IP with user credentials to proceed. SharePoint then saves this information as hard-coded at multiple places for future operations (database/registry etc.). Now if you need to change the database server in any case then you can’t simply change the server as previous server name will already be hard-coded on the farm.

So for such scenario, you create a permanent SQL Server alias for your SharePoint farm and can change the database server name/IP under the hood without recreating the whole farm as SharePoint will be continued referring the alias name in place of server name/IP.

Steps to create a SQL Server Alias:

  1. Go to SQL Server box and fire SSMS editor; run query

    select @@SERVERNAME

  2. Above step will give you the name of SQL Server instance. Copy it for later use.
  3. Now go to application/wfe server; Open SQL Server client network utility. (I would recommend that on every machine do the aliasing on both flavors i.e. 32 bit and 64 bit)
    1. For 32 bit;


    2. For 64 bit;


  4. Do the steps as highlighted in below screenshot. Click on Alias tab, and click on Add… button.
  5. Give a user-friendly name in Server alias: box, select TCP/IP in Network libraries section.
  6. Paste the details from #2 in Server name text box and check Dynamically determine port and click Ok.
  7. 2018-06-07 15_16_39-Clipboard
  8. Do step #3-#6 on all servers in farm and you are done with SQL aliasing.

Use the SQL Server Alias, wherever a database server instance name is required (config files, farm setup etc.). This is the best way to hide the SQL Server instance name as well.

Happy SharePointing 🙂



SharePoint search is returning 500 internal server error page : Resolved

Recently i was working on a Intranet Portal and most part of it was based on documents collaboration. So to easily find a document i configured search for the site. I created a new content source in existing search service application and crawl the source. It was crawled successfully without showing an error or warning, but when i opened the site in IE i was presented by an 500 internal server error page. I tried one more time and same result, i suspect that there is something fishy in IIS (may be application or app pool is stopped). To my surprise there was nothing like that, i reset the IIS but same result. After checking the log file i found this weird entry.

System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure “Resources.lutron.core.resources” was correctly embedded or linked into assembly “App_GlobalResources.0whxr_of” at compile time, or that all the satellite assemblies required are loadable and fully signed.    at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)     at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)     at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)     at System.Resources.ResourceManager.GetObject(String name, CultureInfo culture, Boolean wrapUnmanagedMemStream)     at System.Web.Compilation.BaseResXResourceProvider.GetObject(String resourceKey, CultureInfo culture)     at System.Web.Compilation.ResourceExpressionBuilder.GetResourceObject(IResourceProvider resourceProvider, String resourceKey, CultureInfo culture, Type objType, String propName)     at System.Web.HttpContext.GetGlobalResourceObject(String classKey, String resourceKey, CultureInfo culture)     at Microsoft.SharePoint.Search.SPSatelliteResourceExpressionBuilder.GetResource(String classKey, String resourceKey)     at ASP._layouts_accessdenied_aspx.__BuildControlltAccessDeniedCaption()

After sometime i opened the site in Chrome and search was working fine there same was with Firefox. So i thought that there is problem with browser not with SharePoint server. After digging in to IE settings i came to know that there wasn’t any default language set for my IE (Might be i removed this for some testing purpose.)

Every user has a search preference inside SharePoint site and it can be accessed through below link.


In this page, by default search language is set as ‘Search using my browser’s language‘. Other option is ‘Search using the following languages (maximum of five)‘. So if the option 1 (default) is selected then there should be a default language set in your browser otherwise you’ll get 500 internal server error.

In case option 2 is selected, then search is not dependent on browser language preference. In my case i just set the browser default language in place of opt for option 2. Below are the steps.

  1. Tools > Internet Options.
  2. Under General tab, click on languages button.
  3. Inside Language Preference window, add a language (in my case it was English (United States) ). If you add multiple languages in this window then the first one will be treated as the default language for browser.

*You can also opt for option 2 mentioned above as per your choice.

Happy SharePointing 🙂

Remove orphan feature(s) entry from SharePoint’s ManageFeatures.aspx

At times we need to get rid of feature(s) from SharePoint farm, those are no longer required. This is kind of cleaning and managing your SharePoint Farm. Most of the time due to inappropriate procedure or by using a 3rd party tool, Feature gets removed but it still displays on Feature.aspx page. When you try to search this feature through PowerShell or by tool, this feature becomes unavailable.

The simple reason of this is that it gets degraded and loose its scope and it has an orphaned entry in database.

So below are the steps to resolve this i.e. to clean up the feature reference from ManageFeature.aspx page.

  • First of all open ManageFeature.aspx and copy the title of the feature that needs to be removed from the page. Paste the title in a notepad file (To remove any formatting or extra space while copying the title).
  • Open SharePoint Management Shell as an administrator.
  • Run below commands:

$feature = Get-SPFeature | ? { $_.GetTitle(1033) -eq “Orphaned feature name” }


Happy SharePointing !

PeoplePicker not showing FBA users (Claims Based Authentication)

Recently i faced an issue in a SharePoint site while i was trying to add a FBA user in a site group. On searching the user in people picker, it was not showing the FBA user(s) to select. Every time i searched the FBA user(s) through people picker, it returned me only user(s) from AD. I searched Google but no clear instructions on how to resolve this issue. Finally after some R&D, i was able to resolve this. So i thought to pen it down step by step for you guys. Here are the steps.

First we need to know the values of ‘Membership Provider’ and ‘Role Manager’ of web application.

1. Navigate to Central Administration > Application Management > Manage web applications (Under Web Applications section)
Directly navigate to http://<CA URL>/_admin/WebApplicationList.aspx

2. Select web application (That’s need to be configure for FBA users search.).
3. Click on Authentication Providers from ribbon.
4. Inside Authentication Providers pop up, Click on ‘Default’ hyperlink under zone column.
5. On Edit Authentication Modal popup page, go to Claims Authentication Types.
6. Note down the value of ‘ASP.NET Membership provider name’ and ‘ASP.NET Role manager name’.
7. Exit from the CA.

Make entries in web.config of application.

1. Open web.config file inside ‘C:\inetpub\wwwroot\wss\VirtualDirectories\<Application Folder>’ folder.
2. Search for ‘<PeoplePickerWildcards>’
3. Now add values of ‘Membership Provider’ and ‘Role Manager’ in this section as shown below.
<clear />
<add key=”<Your Membership Provider Value Goes Here>” value=”%” />
<add key=”<Your Role Manager Value Goes Here>” value=”%” />
4. Save and close the web.config.
5. Now find FBA user through people picker and it will work.

Happy Share Pointing 🙂

Proper Deployment Steps for SharePoint Timer Job Service

I created a share point time job using visual studio 2010. I deployed that job using VS and i got some error while debugging this job. I rectified the error and again deployed this but when i debugged again my timer job picking up the old references. For my wonder i deployed this again and again but same issue was still there even i manually deployed the job and referenced assemblies in to GAC. At last i removed each and ever reference manually and again redeployed this but the problem was pathetic and my recent changes were not picked up by timer job. Finally i came to know that “SharePoint 2010 Timer” service holds the old reference even i redeployed the solution by visual studio. So below are the steps that how i rectified this issue and the proper way of deployment of SharePoint Timer job so that if you modify the timer job code and redeployed this then new changes should be picked up by timer job.

  1. Deploy the timer job first. (Either directly by Visual Studio or Power Shell script or STSADM using wsp).
  2. Go to Start > Run (Windows Key+R)
  3. Type Services.msc and hit enter or click on OK.
  4. Now inside service console locate “SharePoint 2010 Timer”.
  5. Stop and Start service (You can directly use Restart option).
  6. Now go to Start > Run (Windows+R) again
  7. Type IISRESET and hit enter.
  8. After iisreset successfully your new modifications inside timer job code will be picked up and service will run smooth(If code written for timer job is correct.).

Happy SharePointing 🙂 Enjoy 🙂

Search Crawling Error “The filtering process could not load the item…” in SharePoint 2010 : Resolved

“The filtering process could not load the item. This is possibly caused by an unrecognized item format or item corruption.”
In our production server this warning was generating with many items while crawling sites for search. Due to this we were unable to find the content of our custom pages during search. After a long period of time we could get the actual issue. We tried each and every settings related to search in Share Point server with no luck. We also goggled a hell lot of topics regarding this but couldn’t resolve this. While goggling i found some interesting links those says that this issue comes due to the missing or corrupt installation of pdf iFilter. Though we don’t have any pdf document anywhere on the site even then we installed the pdf iFilter correctly two times with no luck. More interesting thing was that this error was generating for Share Point server’s default pages like AllItems.aspx etc. This search crawling was running successfully on all other servers. So where was the actual problem ?
Problem: While upgrading this server a Microsoft Office 2010 update corrupt the Filter Packs of this server and this corruption was causing the crawling issue. Generally people aware of pdf iFilter but apart from this iFilter there are other filters installed too for smooth processing of search crawling and they were corrupted however in our case.
Resolution: I just download the Microsoft Office 2010 Filter Packs (64 bit) and reinstall them again. After that reset the search index and crawl again and voila i got my search crawling smooth without any warning and errors. Everything worked fine after that. Download link for Microsoft Office 2010 Filter Packs is mentioned below:
Enjoy… Happy SharePointing 🙂 ….

Set Welcome Page using PowerShell : SharePoint 2010

By default a SharePoint 2010 publishing site uses default.aspx as its welcome page. There are so many conditions where we use our custom web part page as the default page for our publishing site in place of general default.aspx. The best example for this is an application dashboard as the default page. Though its very easy to set the welcome page in a SharePoint site by navigating to Site Settings and under Look and Feel section click on Welcome Page.

Now the question is why i wrote power-shell script for such a simple task.

Answer 1: I want a one click deployment solution for my custom code that includes features, event receivers, web parts etc. I don’t want to remember steps, just i run a batch file and execute everything inside from that batch file.

Answer 2: In my solution i have custom pages and i wrote the deployment script to create those pages. During development if we change any page for java-script, CSS etc. then we need to redeploy the pages to check the implementation. So we need to delete all pages first and then redeploy them otherwise pages so the double instance of each web parts inside that. Well we know that you can’t delete a page directly that is set as welcome page in SharePoint site so in this case you need to set another page as welcome page first then delete the page you want to. So during my development cycle this was very irritating that before deployment of my custom pages i need to first  set Under_Construction.aspx page as my welcome page then delete my actual welcome page then deploy custom pages and then again set the actual page as welcome page. What is your machine is slow and after any deployment it runs pathetically slow..

Oh my god it sucks.. So for all this i wrote a script to set welcome page so that before and after the deployment of pages i could run this and rest of the work it do automatically. So below is the script:

Add-PsSnapin Microsoft.SharePoint.PowerShell
$web=Get-SPWeb -Identity “http://kailash1689new:9007&#8221; -AssignmentCollection $assignment
Stop-SPAssignment $assignment
Write-Host ‘Welcome Page Set Successfully…’
Write-Host ‘Press any key to exit…’

Hide View All Site Content and Recycle Bin in Quick Launch SharePoint 2010: Resolved

When I worked on MOSS 2007 I wrote an article regarding Hide View All Site Content and Recycle Bin in Quick Launch: Resolved and this article is one of the most popular article @ my blog.

But that article was suitable only for MOSS 2007. As there are lots of changes from MOSS 2007 to SharePoint 2010, so that article can’t be applied on SharePoint 2010.

One blog surfer told me regarding this and then i decide to dig out that how will we achieve same thing in SharePoint 2010. So after doing some research I could make it happen in SharePoint 2010. Below are the steps to achieve this:

1. Open Notepad and paste following style inside the notepad file:


.s4-specialNavLinkList {




2. Now save this text file on your system.

3. Open the site where you want to hide Recycle Bin and All Site Content links and upload saved text file in to a document library.

4. After uploading the file click on the name of the file inside document library. Now a dialog box will open and ask for Read Only or Edit Mode.

5. Just select Read Only mode and ok.

6. Text fill will display inside browser. Copy the URL of text file from address bar of browser.

7. No open SharePoint 2010 page where you want to hide Recycle Bin and All Site Content Links.

8. Put Page in edit mode and add a Content Editor Web Part (This web part is inside Media and Content Category in SharePoint 2010) inside the page.

9. Now click on Edit Web Part from context menu.

10. Inside Content Link text box paste the URL u copied earlier in step 6.

11. Click on Ok and you are done.

Happy SharePointing 🙂

Add Safe Control Entries to SharePoint 2010 Web Parts using VS2010

I was reviewing a SharePoint solution and found that a web part inside that solution has poor naming conventions so I decide to rename the web parts for giving the proper names to them.

I changed the necessary references in different files of web part (I’ll mention them in a separate blog post). Now after renaming the web part I deployed it on site and then tried to add it in a web part page and it simply throws me the error.

Type is not registered as safe“. Well at first glance I decided to see me safe controls entries inside my site’s web.config file and I was right that namespace part was wrong in web.config file. It was pointing to earlier namespace and class name. Humnnnn so if I changed this entry manually then it works fine but I need to automate the deployment process and I wanted to write the correct safe controls entries inside web.config whenever we deploy the web part. Well so question arises where to set my safe control entries inside my SharePoint solution. Well after analysing that I came to the solution. So below are the steps described for that:

1. Open your SharePoint web part project inside visual studio 2010.

2. Select the web part folder for which you want to change the safe control entries in web.config file.

3. Press F4 to open properties window (I am not talking here for property page.).

4. In properties windows there is last entry of properties displaying as “Safe Control Entries

5. Click on the eclipse sign in front of “Safe Control Entries” value.

6. Inside “Safe Control Entries” pop up window, check for Namespace properties inside SafeControlEntry1 properties panel.

7. Change value of namespace property according to your namespace and class and click ok.

8. Save and build the solution and deploy it again.

9. Now after successful deployment check web.config of site and voilà you’ll find the correct safe type entries of your web part.

Happy Share Pointing J

Microsoft made the excellent integration of SharePoint with Visual Studio 2010. Good to see that.

In my next blogs I’ll come with these types of enhancements that visual studio provides for SharePoint 2010.

Installing assembly in GAC in Windows Server 2008 : Resolved

I developed an event handler and need to deploy it on production server. My production server is built on Windows 2008 Enterprise Server 64 Bit and there was only one installation on server i.e. SharePoint Server 2010. Now I need to install my assembly in to GAC. I copied my .dll to production server. Then I opened c:\windows\assembly and drag drops my assembly in to GAC (c:\windows\assembly folder). But nothing happened and my assembly couldn’t install in GAC 😦

Drag and drop was not working. So second alternative was to use gautil.exe to install the assembly inside GAC but as it was production server so there wasn’t any installation of visual studio and hence there was no SDK installed therefore there wasn’t such exe like gacutil.exe. Again that was a problem. Now I worked on why drag and drop is not working. I searched here and there and follow some articles but nothing helped me. I disable UAC and restart server but it doesn’t work. I opened console and explorer using run as administrator but nothing helped me. Then I copied gacutil.exe file from my development machine to production server but I couldn’t run it (Though lastly this technique worked for me).So finally I resolved this issue and below are the directions for how to resolve this?

1. First check that if production server is of 32 bit or 64 bit?

2. If it is 64 bit then open folder “C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\x64

But if it is 32 bit then open folder “C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin

3. Copy 2 files i.e. gacutil.exe & gacutil.exe.config

4. Paste these files to any location of production server.

5. Your gacutil.exe is now ready to run and u can install assembly in to GAC using this small utility.

 Points to Remember

* When you drag and drop assembly in GAC it won’t give proper error messages (Like targeting framework error) if it has any so better to use gacutil to install assembly.

* gacutil.exe doesn’t run standalone rather it needs a configuration file to run i.e. gacutil.exe.config