Error when sending or listening, Azure ServiceBus

2019-08-07 04:01发布

问题:

I have a client that sending and listening on a topic in Azure ServiceBus. The client is running locally on my Windows 8.1 machine. But I got following exception on SendAsync and ReceiveAsync:

A first chance exception of type 'System.InvalidOperationException' occurred in System.dll

Additional information: The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly.

The code looks like this:

string connectionString = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ConnectionString");

            var client = SubscriptionClient.CreateFromConnectionString(connectionString, topic, subscriptionId);

            while(true)
            {
                var message = await client.ReceiveAsync();

and

string connectionString = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ConnectionString");

            TopicClient client =
                TopicClient.CreateFromConnectionString(connectionString, topic);

            var msgToSend = new BrokeredMessage(msg);

            await client.SendAsync(msgToSend);

Ang one with a solution to this problem?

回答1:

It was a firewall related issue.