Saturday, March 9, 2019

A timeout has error occured while invoking commands in sharepoint host process

Recently I faced issue while deploying my sharepoint 2013 solution through Visual studio. During this time feature activation was keep on failing with timeout issue. Initially I thought it might be due to some long running operation in feature receiver code may be causing the issue.

Then I created the package and deployed the solution with powershell script and it went fine, its the time to activate the feature which was giving trouble. First I tried to activate the feature with PS and its worked fine, then deactivated and later tried with UI just to make sure if it breaks out. But no surprises, the feature activated with out any issue.

Now its the time to trouble shoot why its failing in VS2013. Then I started looking into MSDN links and found out there is Registry key called "ChannelOperationTimeout" which take care of time out issue in VS. If we have more feature activation code needs to be executed in during deployment from VS it will break out. Default value set to 120 sec, ideally most of the code should get activated, some times if we are running the code in VM which is allocated with less memory. R/W operation, RAM, free space all these maters while activating the feature from VS. If we have such environment its better to increase the default value of 120 sec to 300 sec(its not mandatory to give 300 sec this worked in my case :)), we can choose any suitable time interval to fix this problem.

Now will provide the steps to change the registry key value.

1) Open Registry editor with admin privilege
2) [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\SharePointTools]
3) Create New Keyword(DWORD) called  ChannelOperationTimeout
4) Set the value to 300(it will be in second)
5) If the key is already present then we need to just update the value.
6) Save the value
7) Restart the machine, since we are updating the Registry value.

Now if we deploy the solution from VS it should work without any error.

Root cause of the issue: Server memory, Disk space, R/W disk