I am facing the issue. I have created the ServiceBus Queue on Azure portal. Also I have written the .Net core application for send the data. When I Send the data to queue from my application then I have got the below error message at the connection string when QueueClient initialize :
"The argument namespaceConnectionString is null or white space.\r\nParameter name: namespaceConnectionString"
I have google as well and tried all the options like remove the EntityPath from the connection string. Also tried the different Target Framework version (till 3.1) as well currently using .Net Core 2.2.
Please help me.
using AzureTestProject.Interface;
using Microsoft.Azure.ServiceBus;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AzureQueueService
{
public class ServiceBusQueue
{
private QueueClient _queueClient;
private readonly IConfiguration _configuration;
private const string QUEUE_NAME = "devicetestqueue";
private string _connectionString;
// Payload = {"Id":"1","Type":"Device1","SerialNumber":"10001"}
public async Task SendMessage(object payload)
{
try
{
_queueClient = new QueueClient(
_configuration.GetConnectionString("Endpoint=sb://Subscription.servicebus.windows.net/;SharedAccessKeyName=DeviceTestQueueListenAccessKey;SharedAccessKey=hjklgtfapinznyx2gSnPqngQgIa9p7AxeihLoBz8+Sc=;EntityPath=devicetestqueue"),
QUEUE_NAME);
string data = JsonConvert.SerializeObject(payload);
Message message = new Message(Encoding.UTF8.GetBytes(data));
await _queueClient.SendAsync(message);
}
catch (Exception ex)
{
throw;
}
}
}
}