apache / rocketmq-clients

RocketMQ Clients - Collection of Client Bindings for Apache RocketMQ
https://rocketmq.apache.org/
Apache License 2.0
311 stars 204 forks source link

[Bug] NET8.0环境下无法启动成功 #842

Open danny-adu opened 1 week ago

danny-adu commented 1 week ago

Before Creating the Bug Report

Programming Language of the Client

C#

Runtime Platform Environment

win10

RocketMQ Version of the Client/Server

version: '3.5' services: namesrv: image: apache/rocketmq:latest container_name: rmqnamesrv ports:

networks: rocketmq_net: driver: bridge

Run or Compiler Version

vs2022

Describe the Bug

Grpc.Core.RpcException:“Status(StatusCode="Unavailable", Detail="Error starting gRPC call. HttpRequestException: An HTTP/2 connection could not be established because the server did not complete the HTTP/2 handshake. (InvalidResponse) HttpIOException: An HTTP/2 connection could not be established because the server did not complete the HTTP/2 handshake. (InvalidResponse) HttpIOException: The response ended prematurely while waiting for the next frame from the server. (ResponseEnded)", DebugException="System.Net.Http.HttpRequestException: An HTTP/2 connection could not be established because the server did not complete the HTTP/2 handshake. (InvalidResponse)")”

Steps to Reproduce

[TestMethod] [ExpectedException(typeof(InvalidOperationException))] public void TestSendBeforeStartup() { var clientConfig = new ClientConfig.Builder().SetEndpoints("127.0.0.1:9876").EnableSsl(false).Build();

AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);

var producer = new Producer.Builder()
    // Set the topic name(s), which is optional but recommended.
    // It makes producer could prefetch the topic route before message publishing.
    .SetTopics("testTopic")
    .SetClientConfig(clientConfig)
    .Build().ConfigureAwait(false).GetAwaiter().GetResult();

var message = new Message.Builder().SetTopic("testTopic").SetBody(Encoding.UTF8.GetBytes("foobar")).Build();
var result = producer.Send(message).ConfigureAwait(false).GetAwaiter().GetResult();

Assert.IsTrue(result.MessageId != null);

}

What Did You Expect to See?

我把NET6.0框架去掉,只用NET8.0,无法使用

What Did You See Instead?

生产者无法把数据推送给rocketmq

Additional Context

No response

gisakuya commented 1 day ago

var clientConfig = new ClientConfig.Builder().SetEndpoints("127.0.0.1:9876").EnableSsl(false).Build(); SetEndpoints要的是代理(Proxy)的端口(8080、8081),9876是NameServer的端口