[WebToolsE2E][Aspire] After adding Aspire.Confluent.Kafka component and related codes, there are some messages "localhost:xxxxx/bootstrap: Disconnected while requesting ApiVersion" in CMD when running the aspire project.
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 201
Description
**INSTALL STEPS**
1. Clean machine: Win11 x64 23h2 ENU
2. Install SDK 9.0.100-rc.2.24474.11
- Apply feed for SDK 9.0 RC2
3. Install Aspire 9.0.0-preview.4.24475.9
- Apply the dotnet8 feed for Aspire 9.0
**REPRO STEPS**
1. Open CMD, create an Aspire Starter App using following commands:
```
dotnet new aspire-starter -o AspireStarterApp
cd AspireStarterApp
```
2. Add the Aspire.Confluent.Kafka component to your AspireStarterApp.Web app:
```
cd AspireStarterApp.Web
dotnet add package Aspire.Confluent.Kafka --version 9.0.0-preview.4.24475.9
```
3. In the Program.cs file of the AspireStarterApp.Web project, type following codes:
`builder.AddKafkaProducer("messaging");`
4. Open appsettings.json of AspireStarterApp.AppHost project, add ConnectionStrings configuration section:
```
{
"ConnectionStrings": {
"myConnection": "broker:9092"
}
}
```
5. Add the Aspire.Hosting.Kafka component to your AspireStarterApp.AppHost app:
```
cd ..
cd AspireStarterApp.AppHost
dotnet add package Aspire.Hosting.Kafka --version 9.0.0-preview.4.24475.9
```
6. Open Program.cs of AspireStarterApp.AppHost project, add following codes:
```
var messaging = builder.AddKafka("messaging");
var myService = builder.AddProject()
.WithReference(messaging);
```
7. Run the project in CMD, and open URL in the browser.
`dotnet run`
**ACTUAL**
After the messaging container state is running, there are some messages in CMD.

**Error Log:**
```
%6|1727406956.153|FAIL|rdkafka#producer-1| [thrd:localhost:59716/bootstrap]: localhost:59716/bootstrap: Disconnected while requesting ApiVersion: might be caused by incorrect security.protocol configuration (connecting to a SSL listener?) or broker version is < 0.10 (see api.version.request) (after 5001ms in state APIVERSION_QUERY)
%3|1727406956.153|ERROR|rdkafka#producer-1| [thrd:localhost:59716/bootstrap]: 1/1 brokers are down
%3|1727406956.153|ERROR|rdkafka#producer-1| [thrd:app]: rdkafka#producer-1: localhost:59716/bootstrap: Disconnected while requesting ApiVersion: might be caused by incorrect security.protocol configuration (connecting to a SSL listener?) or broker version is < 0.10 (see api.version.request) (after 5001ms in state APIVERSION_QUERY)
```
Contributor guide
Research direction
Reproduce the setup from the issue, starting with Program.cs in AspireStarterApp.Web and AspireStarterApp.AppHost, then inspect the appsettings.json ConnectionStrings configuration. Run the project with dotnet run and compare the Kafka producer's broker connection output with the reported ApiVersion and broker-down messages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, kafka
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100