Hi Team
I am trying to readmessage2device, each time want to readmessage2device, i often get this websocket exception.
This method it does the following for running;
- private static async Task Main(string[] args)
- {
- Console.WriteLine("IoT Hub App - Read device to cloud messages.");
- var connectionString = new EventHubsConnectionStringBuilder(new Uri(s_eventHubsCompatibleEndpoint), s_eventHubsCompatiblePath, s_iotHubSasKeyName, s_iotHubSasKey);
- s_eventHubClient = EventHubClient.CreateFromConnectionString(connectionString.ToString());
- var runtimeInfo = await s_eventHubClient.GetRuntimeInformationAsync();
- var d2Partitions = runtimeInfo.PartitionIds;
- CancellationTokenSource cts = new CancellationTokenSource();
- Console.CancelKeyPress += (s, e) =>
- {
- e.Cancel = true;
- cts.Cancel();
- Console.WriteLine("Exiting...");
- };
- var tasks = new List<Task>();
- foreach(string partition in d2Partitions)
- {
- tasks.Add(ReceiveMessagesFromDeviceAsync(partition, cts.Token));
- }
- Task.WaitAll(tasks.ToArray());
- }
- }
- }
What could be the reason for this? Firewall issue or network, cant seem to understand where its getting it from.