I am using asp.net 4.0 and c#.net is there any way to know that by supplying applicationId or webrole name (or both) and know how many instances are present in perticular webrole?
Is there any api available so i can code with c#.net?
I am using asp.net 4.0 and c#.net is there any way to know that by supplying applicationId or webrole name (or both) and know how many instances are present in perticular webrole?
Is there any api available so i can code with c#.net?
Yes,
foreach (var roleDefinition in RoleEnvironment.Roles)
{
foreach (var roleInstance in roleDefinition.Value.Instances)
{
Trace.WriteLine("Role instance ID: " + roleInstance.Id, "Information");
}
}
Your best bet would be to make use of Service Management REST API (http://msdn.microsoft.com/en-us/library/ee460806.aspx). Also take a look at the following thread here: SDK for Service Management API.