private void getCurrentTime() { IPEndPoint endpoint = null; try { endpoint = RoleEnvironment.Roles["HelloFabric_WorkerRole"].Instances[0].InstanceEndpoints["DayTime"].IPEndpoint; } catch (Exception) { WorkerTime.Text = "An error occurred retrieving the worker role endpoint. Make sure that at least one instance of the worker role is running."; return; } using (var client = new TcpClient()) { if (client.TryConnect(endpoint, 10, 5000)) { WorkerTime.Text = client.ReadAllData(); client.Close(); } else { WorkerTime.Text = "An error occurred connecting to the worker role endpoint. Make sure that the worker role is running and is not busy."; } } }