Wednesday, October 17, 2012

Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironmentException


Few days ago, I was working on a Windows Azure App, I created a Web Role  which was representing my application interface. Its purpose was to upload images. I needed to generate thumbnails as well.I thought to delegate this responsibility to a Worker Role. 
My Web Role  add image to a Blob and add a message in queue as well for the worker role, so that it can read it and generate thumbnails for each queued image, later.
When I created a worker role and tried to access the storage account with my defined connection string, it started giving me RoleEnvironmentException , I set the connecting-string for the application so I thought it will work for both Web ad Worker Roles, but it was not the case.
For Windows Azure, we have to set connection string for every worker and web roles, independently. I hope this will help any new bee on Windows Azure. 
Thank You and Happy Coding.......

Tuesday, October 16, 2012

Datatable belongs to another dataset


DataTable already belongs to another DataSet this error we get when we are trying to add table into datatset which is already belonging to another dataset. So whats the solution?Its simpleUse Copy() method of DataTable to add to your dataset e.g.

objDataSet.Tables.Add( dataTableFromDataSetA.Copy() ); 

//here objDataSetis your Dataset and dataTableFromDataSetA is DataTable.


Hope this post save your time. Thank You.
Earn Money ! Affiliate Program
Open Directory Project at dmoz.org