You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Aspire Storage integration does not work due to ;; part in connection string #11967
The queue service clients cant parse DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;QueueEndpoint=http://127.0.0.1:52537/devstoreaccount1;;QueueName=blob-events
Unhandled exception. System.FormatException: No valid combination of account information found.
at Azure.Storage.StorageConnectionString.<>c.<Parse>b__67_0(String err)
at Azure.Storage.StorageConnectionString.ParseCore(String connectionString, StorageConnectionString& accountInformation, Action`1 error)
at Azure.Storage.StorageConnectionString.Parse(String connectionString)
at Azure.Storage.Queues.QueueServiceClient..ctor(String connectionString, QueueClientOptions options)
So if there is a workaround to strip the ``;;` part until fixed that would be much appreciated :D Assuming i am right that its a bug, but also wondering why no one else have hit this, so wonder what i can be doing wrong
.WithEnvironment("ConnectionStrings__blob-events", () =>
{
// This callback will be executed when the connection string is actually resolved
var task = queue.Resource.ConnectionStringExpression.GetValueAsync(CancellationToken.None);
var connectionString = task.GetAwaiter().GetResult();
return connectionString.Replace(";;", ";");
})
private async Task<string?> GetConnectionStringAsync(IResource resource, CancellationToken cancellationToken)
{
// For Azure Storage resources, get the connection string
if (resource is IResourceWithConnectionString connectionStringResource)
{
var conn = await connectionStringResource.GetConnectionStringAsync(cancellationToken);
if(!string.IsNullOrEmpty(conn))
{
// For queue resources, Aspire appends ";QueueName=xxx" to the connection string
// We need to remove this as it's not valid for QueueServiceClient (only for QueueClient)
var queueNameIndex = conn.IndexOf(";QueueName=", StringComparison.OrdinalIgnoreCase);
if (queueNameIndex >= 0)
{
conn = conn.Substring(0, queueNameIndex);
}
// Remove any trailing semicolons
conn = conn.TrimEnd(';');
return conn;
}
}
await Task.CompletedTask;
return null;
}
Above works - still need to figure out if we can do specific connection strings for specific queues for queue service client, i can understand why not and thats properly also something that should be fixed in aspire. The motivation behind appending QueueName= to connection string is interesting here in aspire code.
Thanks Eric Erhardt (@eerhardt), that is indeed the issue.
I spent ages on this today. I was passing in an individual queue.
As I wanted a QueueClient I had initially tried to use builder.AddAzureQueueClient, which seemed the obvious choice, but it's obsoleted, and advises use of builder.AddAzureQueueServiceClient instead, which injects QueueServiceClient.
builder.AddAzureQueue is needed to create a QueueClient, which I hadn't noticed, as it's running outside the naming convention, presumably because the old method creates a conflict.
Improvement options:
Given the clear intent to avoid the historical conflict, it's not easy to fix, there's a naming issue here causing a confusion.
Maybe the error handler could be improved to check for this possibility, and provided clear feedback.
Activity
davidfowl commentedon Oct 12, 2025
What does your client code look like?
pksorensen commentedon Oct 12, 2025
AppHost
and service
MihuBot commentedon Oct 12, 2025
I'm a bot. Here is a possible related and/or duplicate issue (I may be wrong):
davidfowl commentedon Oct 12, 2025
What's the exception you're seeing?
pksorensen commentedon Oct 12, 2025
The queue service clients cant parse
DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;QueueEndpoint=http://127.0.0.1:52537/devstoreaccount1;;QueueName=blob-eventspksorensen commentedon Oct 12, 2025
So if there is a workaround to strip the ``;;` part until fixed that would be much appreciated :D Assuming i am right that its a bug, but also wondering why no one else have hit this, so wonder what i can be doing wrong
davidfowl commentedon Oct 12, 2025
Yes, this part is surprising 😄.
cc Sébastien Ros (@sebastienros) Eric Erhardt (@eerhardt)
pksorensen commentedon Oct 12, 2025
Would you have a hack/workaround to manipuate the connection string in apphost?
pksorensen commentedon Oct 12, 2025
I made a hack
giving this connection string
but that just gave same result,
so not a fix to fix
;;Need to do some tests with queue service client and connection strings then.
pksorensen commentedon Oct 12, 2025
Above works - still need to figure out if we can do specific connection strings for specific queues for queue service client, i can understand why not and thats properly also something that should be fixed in aspire. The motivation behind appending QueueName= to connection string is interesting here in aspire code.
pksorensen commentedon Oct 16, 2025
Aha moment
produces a valid connection string and then at the application level it can be pointed at the actual queue
essenbee2 commentedon Oct 17, 2025
Saved my sanity! Thanks for the solution Poul Kjeldager Sørensen (@pksorensen) 💯
eerhardt commentedon Oct 17, 2025
The problem here is there are 2 similar resources:
When you reference one of these resources, you need to match up the types between the apphost and the app. You either want:
Queues Service
AppHost
App
-- or --
Individual Queue
AppHost
App
Mix and matching will cause issues because the App client expects the connection string to be correct for its type.
ian-gavurin commentedon Nov 14, 2025
Thanks Eric Erhardt (@eerhardt), that is indeed the issue.
I spent ages on this today. I was passing in an individual queue.
As I wanted a QueueClient I had initially tried to use builder.AddAzureQueueClient, which seemed the obvious choice, but it's obsoleted, and advises use of builder.AddAzureQueueServiceClient instead, which injects QueueServiceClient.
builder.AddAzureQueue is needed to create a QueueClient, which I hadn't noticed, as it's running outside the naming convention, presumably because the old method creates a conflict.
Improvement options:
Given the clear intent to avoid the historical conflict, it's not easy to fix, there's a naming issue here causing a confusion.
Maybe the error handler could be improved to check for this possibility, and provided clear feedback.
This isn't helped by the docs, which still direct you to the obsoleted method: https://learn.microsoft.com/en-us/dotnet/aspire/storage/azure-storage-queues-integration?tabs=dotnet-cli#add-azure-queue-storage-client - it could be clarified there too.