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;

      C:\windows\system32\cliconfg.exe

    2. For 64 bit;

      C:\windows\syswow64\cliconfg.exe

  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 🙂

 

Advertisements

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.

http://My_SharePoint_Site/_layouts/EditUserPref.aspx

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” }

$feature.Delete()

Happy SharePointing !