Pages

Thursday, 26 November 2015

Value can not be null Parameter Name:store TFS WorkItem Store Error

Error HRESULT E_FAIL has been returned from a call to a COM component.

Description:
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
   at Microsoft.TeamFoundation.WorkItemTracking.Client.DataStore.DataStoreNative.UpdateMetadata(IntPtr handle, Object rowset, String dbstamp, UInt32& changes)
   at Microsoft.TeamFoundation.WorkItemTracking.Client.DataStore.Datastore.UpdateMetadata(Object rowset, String dbstamp)
   at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore.EndBackendCall(BackendCallData data)
   at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore.RefreshCacheInternal(BackendCallData& data)
   at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore.InitializeInternal()
   at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore.Microsoft.TeamFoundation.Client.ITfsTeamProjectCollectionObject.Initialize(TfsTeamProjectCollection teamProjectCollection)
   at Microsoft.TeamFoundation.Client.TfsTeamProjectCollection.InitializeTeamFoundationObject(String fullName, Object instance)
   at Microsoft.TeamFoundation.Client.TfsConnection.CreateServiceInstance(Assembly assembly, String fullName)
   at Microsoft.TeamFoundation.Client.TfsConnection.GetServiceInstance(Type serviceType, Object serviceInstance)
   at Microsoft.TeamFoundation.Client.TfsTeamProjectCollection.GetServiceInstance(Type serviceType, Object serviceInstance)
   at Microsoft.TeamFoundation.Client.TfsConnection.GetService(Type serviceType)
   at Microsoft.TeamFoundation.Client.TfsConnection.GetService[T]()

If you have already installed TFS Client SDK and successfully executing on localhost.You have to add below tags in your web.config to run you website/web api on remote host.

<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
              <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
       </startup

</configuration>

Hope this will resolve your issue.....

Tuesday, 17 November 2015

Enable 32 bit Applications Azure Cloud Service Hosting automation

Enable 32 bit Applications Azure Cloud Service Hosting automation

Sometime dll issues occured on IIS based on 32-bit or 64-bit dlls.Error occured like below

Could not load file or assembly 'Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader' or one of its dependencies. An attempt was made to load a program with an incorrect format.
If you have already reference with microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader.dll or respective dll and its dependencies. 

Then it may be error due to 32-bit applications disabled on IIS.



To resolve this error, you can set it manually from IIS.
If you need hosted a site again and again. It will be time consuming to enable it.
To automate this, create a startup script with the below given commands
%windir%\system32\inetsrv\appcmd set config -section:system.applicationHost/applicationPools

Save as this line to “setup.bat”.
Then include this file into your project, set "copy local"=true.
Open your ServiceDefinition.csdef and add below lines as in snapshot.
<webrole >
     <Startup>
              <Task commandLine="setup.cmd" executionContext="elevated" />
          </Startup>
</webrole >




















Saturday, 11 April 2015

In Memory Optimized Table in SQL Server 2014


To increase performance of highly accessible tables, a new feature incorporated in Sql Server 2014 “In-Memory OLTP”.You can define a table that is accessed by large no of users at a time as “memory optimized”. Memory-optimized-tables are fully transactional, durable, and are accessed using T-SQL in the same way as disk-based tables.
In memory optimization is designed for extremely high session concurrency for OLTP type of transactions using latch-free data structures and optimistic, multi-version concurrency control.
Example:
-- Creating disk-based table.
CREATE TABLE [dbo].[PersonSimple] (
  ID INT NOT NULL PRIMARY KEY,
  Name NCHAR(48) NOT NULL
)
GO

-- Creating memory-optimized table durable.
CREATE TABLE [dbo].[PersonMemOptimized] (
  ID INT NOT NULL PRIMARY KEY NONCLUSTERED HASH WITH (BUCKET_COUNT=1000000),
  Name NCHAR(48) NOT NULL
) WITH (MEMORY_OPTIMIZED=ON, DURABILITY = SCHEMA_AND_DATA);
GO
BUCKET_COUNT:
BUCKET_COUNT parameter is mandatory when you create the memory-optimized table. If you cannot determine the correct bucket count, use a nonclustered index instead. An incorrect BUCKET_COUNT value, especially one that is too low, can significantly impact workload performance, as well as recovery time of the database. It is better to overestimate the bucket count.
DURABILITY parameter defines table schema or table data with schema to be persisted when database is restarted.
-- Creating memory-optimized table non durable.
CREATE TABLE [NonDurablePersonMemOptimized]
(
ID INT NOT NULL PRIMARY KEY NONCLUSTERED HASH WITH (BUCKET_COUNT=1000000),
Name NCHAR(48) NOT NULL
)WITH (MEMORY_OPTIMIZED = ON, DURABILITY = SCHEMA_ONLY)
GO

If our database does not contain MEMORY_OPTIMIZED_DATA filegroup ,below error occurred on IMO table creation
Msg 41337, Level 16, State 100, Line 7
Cannot create memory optimized tables in a database that does not have an online and non-empty MEMORY_OPTIMIZED_DATA filegroup.

You can only create one memory-optimized file group per database. You need to explicitly mark the filegroup as containing memory_optimized_data.
ALTER DATABASE [ss2014Test] ADD FILEGROUP ss2014TestIMO CONTAINS MEMORY_OPTIMIZED_DATA

You need to add one or more containers to the MEMORY_OPTIMIZED_DATA filegroup. As
ALTER DATABASE [ss2014Test] ADD FILE (name='ss2014TestIMO', filename='c:\IMOfg\ss2014TestIMO') TO FILEGROUP ss2014TestIMO

CREATE TABLE [dbo].[PersonMemOptimized] (
  ID INT NOT NULL PRIMARY KEY NONCLUSTERED HASH WITH (BUCKET_COUNT=1000000),
  Name NCHAR(48) NOT NULL
) WITH (MEMORY_OPTIMIZED=ON, DURABILITY = SCHEMA_AND_DATA);
GO
Now query works.

Important Limitations of IMO Filegroup:
·         Once you create a memory-optimized filegroup, you can only remove it by dropping the database. In a production environment, it is unlikely that you will need to remove the memory-optimized filegroup.
·         You cannot drop a non-empty container or move data and delta file pairs to another container in the memory-optimized filegroup.
·         You cannot specify MAXSIZE for the container.