Wednesday, 21 March 2012

Azure Table Storage - System.MissingMethodException: No parameterless constructor defined for this object. at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.get_Result()

While working with Azure table storage, I got the following error message


System.MissingMethodException: No parameterless constructor defined for this object. at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.get_Result()
....


In order to resolve it, simply define parameterless constructor in the table entity class derived from class TableServiceEntity

e.g.



public class Customer: TableServiceEntity
    {
        public Customer(){} //This is a must to avoid MissingMethodException thrown :)

        //FirstName & LastName identifies row in the table uniquely
        public Customer(string fname, string lname)
        {
            this.PartitionKey = lname;
            this.RowKey = fname;
        }
        public int Age { get; set; }
    }

Cheers,
Milan Gurung

Wednesday, 15 February 2012


Yesterday I had to find a way to host multiple instances of the same application as a different windows services in the same server. In order to achieve this, the quickest and easiest method is to make use of  "sc create" command. SC command allows to create a windows service even on remote computer. You can see documentation here.

You need to run "Command Prompt" as "Administrator" to execute your command.

Imagine you developed a windows service application. Now all that needs to be done is create multiple copies of the folder containing necessary assemblies or binaries. For example if you need to have 3 instances of the same application running as 3 different windows service then you need to create 3 different folders containing the same executables/assemblies.

Now we just need to execute following command -

> sc create ServiceInstance1 binPath= "location of the exe"
> sc create ServiceInstance2 binPath= "location of the exe"
> sc create ServiceInstance3 binPath= "location of the exe"

After successfully executing above commands, we should see 3 new windows services of the same application registered.

Thanks,
Milan Gurung