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
This error is most likely a red herring; a symptom not the cause. My bet is that the emulator container is not starting for some reason. The3G do you see any errors in the logs for the emulator in the Aspire dashboard? Can you check Docker/Podman logs for this container?
Karol Zadora-Przylecki (@karolz-ms) docker logs don't seem to show any errors; the container is starting if I run it via commandline outside of the aspire project (visualstudio) F5
The3G There isn't enough details here to do an investigation. Can you record a video, and provide more information about versions, your project (maybe push a repo to github), what container runtime you are using, operating system etc. Without any of this we cant help with this problem.
David Fowler (@davidfowl)Karol Zadora-Przylecki (@karolz-ms) I'm closing this issue as this seems not to be related to CosmosDB specifically and may be environment as I'm not seeing this on a different machine and I am seeing the same with other aspire projects from templates (without modification)
info: Aspire.Hosting.Azure.AzureCosmosDBContainerResource[0]
connecting: AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==;AccountEndpoint=https://127.0.0.1:59291;DisableServerCertificateValidation=True;
info: Aspire.Hosting.Azure.AzureCosmosDBContainerResource[0]
creating if not exists: appimport
fail: Aspire.Hosting.Dashboard.ServiceClient.DashboardClient[0]
Error #1 watching resources.
Grpc.Core.RpcException: Status(StatusCode="Internal", Detail="Error reading next message. HttpProtocolException: The HTTP/2 server sent invalid data on the connection. HTTP/2 error code 'PROTOCOL_ERROR' (0x1). (HttpProtocolError)", DebugException="System.Net.Http.HttpProtocolException: The HTTP/2 server sent invalid data on the connection. HTTP/2 error code 'PROTOCOL_ERROR' (0x1). (HttpProtocolError)")
---> System.Net.Http.HttpProtocolException: The HTTP/2 server sent invalid data on the connection. HTTP/2 error code 'PROTOCOL_ERROR' (0x1). (HttpProtocolError)
at System.Net.Http.Http2Connection.ThrowRequestAborted(Exception innerException)
at System.Net.Http.Http2Connection.Http2Stream.TryReadFromBuffer(Span`1 buffer, Boolean partOfSyncRead)
at System.Net.Http.Http2Connection.Http2Stream.ReadDataAsync(Memory`1 buffer, HttpResponseMessage responseMessage, CancellationToken cancellationToken)
at System.Net.Http.Http2Connection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at Grpc.Net.Client.Internal.GrpcCall`2.ReadMessageAsync(Stream responseStream, String grpcEncoding, Boolean singleMessage, CancellationToken cancellationToken)
at Grpc.Net.Client.Internal.HttpContentClientStreamReader`2.MoveNextCore(CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at Grpc.Net.Client.Internal.HttpContentClientStreamReader`2.MoveNextCore(CancellationToken cancellationToken)
at Grpc.Net.Client.Internal.Retry.RetryCallBaseClientStreamReader`2.MoveNext(CancellationToken cancellationToken)
at Grpc.Core.AsyncStreamReaderExtensions.ReadAllAsyncCore[T](IAsyncStreamReader`1 streamReader, CancellationToken cancellationToken)+MoveNext()
at Grpc.Core.AsyncStreamReaderExtensions.ReadAllAsyncCore[T](IAsyncStreamReader`1 streamReader, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
at Aspire.Dashboard.ServiceClient.DashboardClient.WatchResourcesAsync(RetryContext retryContext, CancellationToken cancellationToken) in /_/src/Aspire.Dashboard/ServiceClient/DashboardClient.cs:line 350
at Aspire.Dashboard.ServiceClient.DashboardClient.WatchResourcesAsync(RetryContext retryContext, CancellationToken cancellationToken) in /_/src/Aspire.Dashboard/ServiceClient/DashboardClient.cs:line 350
at Aspire.Dashboard.ServiceClient.DashboardClient.WatchWithRecoveryAsync(Func`3 action, CancellationToken cancellationToken) in /_/src/Aspire.Dashboard/ServiceClient/DashboardClient.cs:line 321
different error with new previous 9.5.0; failure to connection using connection string from within the OnResourceReady event inside AppHost.cs using emulator
AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==;AccountEndpoint=https://127.0.0.1:59291;DisableServerCertificateValidation=True;
info: Aspire.Hosting.Azure.AzureCosmosDBContainerResource[0]
creating if not exists: appimport
async Task DatabaseEntityImportFromDirectory(
AzureCosmosDBContainerResource resource,
ResourceReadyEvent resourceReadyEvent,
CancellationToken cancellationToken)
{
var hostEnvironment = resourceReadyEvent.Services
.GetRequiredService<IHostEnvironment>();
var logger = resourceReadyEvent.Services
.GetRequiredService<ILogger<AzureCosmosDBContainerResource>>();
string applicationImportPath = Path.Combine(
hostEnvironment.ContentRootPath.ToLower(),
hostEnvironment.EnvironmentName.ToLower(),
"import"
);
if (!Directory.Exists(applicationImportPath))
Directory.CreateDirectory(applicationImportPath);
var resourceConnectionString = await resource
.Parent.Parent
.ConnectionStringExpression
.GetValueAsync(cancellationToken)
.ConfigureAwait(false);
using(var scoped = logger.BeginScope("importing data from directory"))
{
logger.LogInformation("importing data from directory: {Directory}",
applicationImportPath);
try
{
logger.LogInformation("connecting: {connectionString}",
resourceConnectionString);
CosmosClient resourceClient = new CosmosClient(
resourceConnectionString, new CosmosClientOptions
{
ConsistencyLevel = ConsistencyLevel.Eventual,
LimitToEndpoint = resource.IsEmulator(),
ConnectionMode = resource.IsEmulator() ?
ConnectionMode.Gateway : ConnectionMode.Direct
});
logger.LogInformation("creating if not exists: {databaseName}",
resource.Parent.DatabaseName);
await resourceClient.CreateDatabaseIfNotExistsAsync(
resource.Parent.DatabaseName);
logger.LogInformation("getting database: {databaseName}",
resource.Parent.DatabaseName);
var resourceDatabase = resourceClient.GetDatabase(
resource.Parent.DatabaseName);
logger.LogInformation("creating container: {containerName}",
resource.ContainerName);
await resourceDatabase.CreateContainerIfNotExistsAsync(
resource.ContainerName, resource.PartitionKeyPath);
var resourceContainer = resourceDatabase.GetContainer(
resource.ContainerName);
var importItems = fake.GenerateLazy(10)
.Select(item => new
{
id = Guid.NewGuid().ToString(),
item.Title,
item.Description,
item.Tags,
item.Sensitivity,
item.References,
item.ImportedBy,
item.ImportedOn,
item.PublishedBy,
item.PublishedOn,
filePath = applicationImportPath
});
foreach(var item in importItems)
{
logger.LogInformation("importing item: {Title}", item.Title);
await resourceContainer.CreateItemAsync(
item,
new PartitionKey(applicationImportPath),
cancellationToken: cancellationToken
);
}
}
catch(Exception ex)
{
logger.LogInformation("exception: {errorMessage}",
ex.Message);
}
finally
{
}
}
await Task.CompletedTask;
}
Activity
[-]CosmosDB fails[/-]davidfowl commentedon Jul 29, 2025
Any more information? It doesn’t fail on my machine.
davidfowl commentedon Jul 29, 2025
Karol Zadora-Przylecki (@karolz-ms) David Negstad (@danegsta) have you seen this error before?
karolz-ms commentedon Jul 29, 2025
This error is most likely a red herring; a symptom not the cause. My bet is that the emulator container is not starting for some reason. The3G do you see any errors in the logs for the emulator in the Aspire dashboard? Can you check Docker/Podman logs for this container?
The3G commentedon Jul 29, 2025
Karol Zadora-Przylecki (@karolz-ms) docker logs don't seem to show any errors; the container is starting if I run it via commandline outside of the aspire project (visualstudio) F5
davidfowl commentedon Jul 29, 2025
The3G There isn't enough details here to do an investigation. Can you record a video, and provide more information about versions, your project (maybe push a repo to github), what container runtime you are using, operating system etc. Without any of this we cant help with this problem.
The3G commentedon Jul 29, 2025
David Fowler (@davidfowl) I'll do this tommorrow as it's 23hrs here in the UK;
BTW, I've been using .NET 10 with nightly builds for aspire packages,
but also see this using NET 9.0 and aspire 9.4.0 pacakges.
Docker version 28.3.2, build 578ccf6
Windows 11 Enterprise
Version 24H2
Installed on 18/07/2025
OS build 26100.4652
davidfowl commentedon Jul 29, 2025
Record a video showing what happens in the dashboard and docker.
The3G commentedon Jul 30, 2025
David Fowler (@davidfowl) Karol Zadora-Przylecki (@karolz-ms) I'm closing this issue as this seems not to be related to CosmosDB specifically and may be environment as I'm not seeing this on a different machine and I am seeing the same with other aspire projects from templates (without modification)
karolz-ms commentedon Jul 30, 2025
The3G thanks for the update. Let us know please if we can help you get to the bottom of this in any way.
The3G commentedon Aug 2, 2025
The3G commentedon Aug 2, 2025
different error with new previous 9.5.0; failure to connection using connection string from within the OnResourceReady event inside AppHost.cs using emulator
AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==;AccountEndpoint=https://127.0.0.1:59291;DisableServerCertificateValidation=True;
info: Aspire.Hosting.Azure.AzureCosmosDBContainerResource[0]
creating if not exists: appimport
davidfowl commentedon Aug 3, 2025
The3G what are you looking for here?
The3G commentedon Aug 3, 2025
David Fowler (@davidfowl) we should be able to connect to the CosmosDb emulator from within the OnResourceReady; however the connection string provided is failing as shown when performing an action to check/create the database. I've a simple repo of the issue here https://github.com/[The3G/CosmosDBOnResourceReady](https://github.com/The3G/CosmosDBOnResourceReady)