SQL query timeout from application but works fast from SSMS

Recently faced very strange problem. Application which was working great during last two years just suddenly had timeout on one particular page. The page was always very fast and was showing just last 12 records from the table.

So I did what always was doing to check slow performing query, started SQL Profiler to trace the query. Query by itself is pretty complex and had a lot of parameters, Profiler is the best tool I think in that cases.

After I easily found long running query in Profiler I copy pasted it into SSMS and what a surprize query just run in 300ms. Meanwhile the query from UI ( was running almost 2 minutes.

The first to be different is session variables. To get info about sessions you can just select from the sys.dm_exec_sessions table.
more info about table

Easy way to compare between sessions:


ServicePrinciple authentication for LakeStore and DataFactory

New Authentication method to use in DataFactory to access Lake Store In Feb 2017 there is new authentication method was introduced to use in DataFactory. So you have a choice now between OAuth and Service principle

The OAuth choice will authenticate with Lake store using authentication token which will expire at some point of time. So for that option you just choose OAuth and get token from a popup windows. So Linked Service will look like this for you

For Service Principle you should have a principal created to use it. Here is the link how to do it
So you will need to provide ServicePrinciple id and key.
It makes more sense to use ServicePrinciple in case you have a scheduled job to run and avoid surprise with expired token.

Product catalog template is not available in SharePoint 2016 preview.

Sounds like a bug in preview,
Was preparing for demo but I cannot see Product Catalog template in SharePoint 2016 Preview.

So here is the trick if you need it, just run a powershell command

$template = Get-SPWebTemplate "ProductCatalog#0"

New-SPSite –Url "http:///sites/catalog" -OwnerAlias "\" -Template $template

Sideloading of apps is not enabled on this site - error while debugging SharePoint application


In case if you want to deploy, test or debug a SharePoint application on you newly created web site you can gen an error which looks like this

Error occurred in deployment step 'Install app for SharePoint': Sideloading of apps is not enabled on this site.

It means that the site does not have development feature enabled. Strange and stupid error message which could be more descriptive!

the solution is actually more stupid. you cannot enable it from features because it is hidden, so just run this from PowerShell and enjoy.

Enable-SPFeature e374875e-06b6-11e0-b0fa-57f5dfd72085 –url

Skip domain requirement while configuring database for SharePoint

In case if you forgot to configure domain while installing SharePoint or do not know how to do that you can face an error while configuring DB for SharePoint.

“The specified user is a local account . Local account should only be used in stand alone mode”

The easy way just pre create Databases before configuring SharePoint.

Just run SharePoint management shell and run New-SPConfigurationDatabase command and answer some sample question. The command will create configuration databases so you will be able to skip that step in the wizard.

May be not the best idea for production but in test environment this can save a lot of time.

Google Reader is closing. Any good alternatives?

Since Google will be closed in June (or July) do not remember exact date I became a little sad since I was using that during last years as a primary source for news reading, and probably that was the most visited site by me hhmmmm, may be more than email or facebook.

So after sad news I have started to search for something new where I can customize my RSS feed and filter information I need and like to read and avoid all the crap from the Internet. After some time my search ended with two sites.

Probably 2nd one looks cool, but it has limited options for RSS feed and tries to offer me a lot of stupid staff which I really do not need.
The first one is almost a clone of Google reader and honestly I was happy to find that! At the moment have some issues but hope will become better much better and will have longer life than Google Reader.

Also recently found an app on my surface for news reading, but hell, really I do not need your offers a…

How dangerous can be “public const” while upgrading or fixing a component.

During my investigation I have noticed a source of potential problem for product upgrade where dev team should fix a bug or upgrade a component and distribute it. So what will happen when during fix/upgrade process (I will call it upgrade) a value which was declared as public const was changed. For clear understanding we should see how build process is done. Actually during build process all variables which consume const will be hardcoded. It is not a problem when it is references from the same project, component will be rebuilt anyway. But what if it is referenced from another dll? The value will remain hardcoded and will contain old value. Tools.dll MyConstants.cs
public const int DEFAULT_PORT = 80;
Service.dll Host.cs
So after upgrade of Tools.dll and change of the DEFAULT_PORT to 8080, Service.dll still will try to start service on 80 port! That is easy to test, just build a solution, copy components to another folder, change const value, rebuild and co…