Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/161.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
连接到C+时出错+;来自gRPC dotnet的gRPC服务器:连接字符串不匹配:应为';R';(82)获得';O';(79)字节1处 < >我用官方的例子创建了一个C++ GRPC服务器。_C++_.net_.net Core_Grpc - Fatal编程技术网

连接到C+时出错+;来自gRPC dotnet的gRPC服务器:连接字符串不匹配:应为';R';(82)获得';O';(79)字节1处 < >我用官方的例子创建了一个C++ GRPC服务器。

连接到C+时出错+;来自gRPC dotnet的gRPC服务器:连接字符串不匹配:应为';R';(82)获得';O';(79)字节1处 < >我用官方的例子创建了一个C++ GRPC服务器。,c++,.net,.net-core,grpc,C++,.net,.net Core,Grpc,我正试图使用grpc dotnetlibs从.NET Core 3.0使用此服务器。我在v1.24.x(3e4007e)分支中使用grpc++ 但是,连接时,我在服务器上遇到以下错误: I1022 10:28:38.903132223 24226 timer_generic.cc:738] TIMER CHECK END: r=1; next=15010 I1022 10:28:38.903143514 24226 timer_manager.cc:188] sl

我正试图使用
grpc dotnet
libs从.NET Core 3.0使用此服务器。我在
v1.24.x
3e4007e
)分支中使用grpc++

但是,连接时,我在服务器上遇到以下错误:

I1022 10:28:38.903132223   24226 timer_generic.cc:738]       TIMER CHECK END: r=1; next=15010
I1022 10:28:38.903143514   24226 timer_manager.cc:188]       sleep for a 1001 milliseconds
I1022 10:28:39.704884424   24227 tcp_server_posix.cc:242]    SERVER_CONNECT: incoming connection: ipv4:127.0.0.1:35425
D1022 10:28:39.704922757   24227 tcp_posix.cc:1253]          cannot set inq fd=11 errno=92
I1022 10:28:39.704957089   24227 timer_generic.cc:365]       TIMER 0x7ffa640017a8: SET 134812 now 14812 call 0x7ffa640017d8[0x7ffa78ab7210]
I1022 10:28:39.704970089   24227 timer_generic.cc:401]         .. add to shard 9 with queue_deadline_cap=15009 => is_first_timer=false
I1022 10:28:39.704983130   24227 handshaker.cc:131]          handshake_manager 0x7ffa640016f0: error="No Error" shutdown=0 index=0, args={endpoint=0x7ffa640011b0, args=0x7ffa640019b0 {size=2: grpc.primary_user_agent=grpc-c++/1.24.2, grpc.compression_enabled_algorithms_bitset=15}, read_buffer=0x7ffa64001a10 (length=0), exit_early=0}
I1022 10:28:39.705019588   24227 handshaker.cc:164]          handshake_manager 0x7ffa640016f0: handshaking complete -- scheduling on_handshake_done with error="No Error"
I1022 10:28:39.705031005   24227 timer_generic.cc:467]       TIMER 0x7ffa640017a8: CANCEL pending=true
I1022 10:28:39.705065212   24227 timer_generic.cc:365]       TIMER 0x7ffa64003648: SET 7214812 now 14812 call 0x7ffa640035a8[0x7ffa78aff900]
I1022 10:28:39.705076629   24227 timer_generic.cc:401]         .. add to shard 7 with queue_deadline_cap=15009 => is_first_timer=false
I1022 10:28:39.705088003   24227 bdp_estimator.h:53]         bdp[ipv4:127.0.0.1:35425]:sched acc=0 est=65536
I1022 10:28:39.705113295   24227 chttp2_transport.cc:839]    W:0x7ffa64001f00 SERVER [ipv4:127.0.0.1:35425] state IDLE -> WRITING [TRANSPORT_FLOW_CONTROL]
I1022 10:28:39.705126336   24227 chttp2_transport.cc:839]    W:0x7ffa64001f00 SERVER [ipv4:127.0.0.1:35425] state WRITING -> WRITING+MORE [INITIAL_WRITE]
I1022 10:28:39.705137711   24227 init.cc:164]                grpc_init(void)
I1022 10:28:39.705183127   24227 chttp2_transport.cc:1900]   perform_transport_op[t=0x7ffa64001f00]: ON_CONNECTIVITY_STATE_CHANGE:p=0x7ffa640042e0:from=IDLE SET_ACCEPT_STREAM:0x7ffa78aeeaa0(0x7ffa64004278,...)
I1022 10:28:39.705194418   24227 timer_generic.cc:365]       TIMER 0x7ffa640018a8: SET 134812 now 14812 call 0x7ffa640018d8[0x7ffa78b6b670]
I1022 10:28:39.705229459   24227 timer_generic.cc:401]         .. add to shard 6 with queue_deadline_cap=15009 => is_first_timer=false
I1022 10:28:39.705265667   24227 connectivity_state.cc:100]  CONWATCH: 0x7ffa640021a8 server_transport: from IDLE [cur=READY] notify=0x7ffa640042e0
I1022 10:28:39.705322666   24227 chttp2_transport.cc:1900]   perform_transport_op[t=0x7ffa64001f00]: ON_CONNECTIVITY_STATE_CHANGE:p=0x7ffa640042e0:from=READY
I1022 10:28:39.705334041   24227 timer_generic.cc:467]       TIMER 0x7ffa64003648: CANCEL pending=true
I1022 10:28:39.705345415   24227 tcp_posix.cc:265]           TCP:0x7ffa640011b0 notify_on_read
I1022 10:28:39.705356748   24227 connectivity_state.cc:100]  CONWATCH: 0x7ffa640021a8 server_transport: from READY [cur=READY] notify=0x7ffa640042e0
I1022 10:28:39.705368123   24227 timer_generic.cc:365]       TIMER 0x7ffa64003648: SET 7214812 now 14812 call 0x7ffa640035a8[0x7ffa78aff900]
I1022 10:28:39.705379456   24227 timer_generic.cc:401]         .. add to shard 7 with queue_deadline_cap=15009 => is_first_timer=false
D1022 10:28:39.705402123   24227 flow_control.cc:113]        0x7ffa64003368[0][svr] | t updt sent | trw:                         65535, tlw:                       4194304, taw:              65535 -> 4194304, srw:                              , slw:                              , saw:                              
I1022 10:28:39.705433539   24227 writing.cc:116]             SERVER: Ping sent [ipv4:127.0.0.1:35425]: 2/2
I1022 10:28:39.705447205   24227 chttp2_transport.cc:839]    W:0x7ffa64001f00 SERVER [ipv4:127.0.0.1:35425] state WRITING+MORE -> WRITING [begin write in current thread]
I1022 10:28:39.705460205   24227 tcp_posix.cc:1058]          WRITE 0x7ffa640011b0 (peer=ipv4:127.0.0.1:35425)
D1022 10:28:39.705495954   24227 tcp_posix.cc:1062]          DATA: 00 00 18 04 00 00 00 00 00 00 04 00 40 00 00 00 05 00 40 00 00 00 06 00 00 20 00 fe 03 00 00 00 01 '............@.....@...... .......'
I1022 10:28:39.705507371   24227 tcp_posix.cc:1058]          WRITE 0x7ffa640011b0 (peer=ipv4:127.0.0.1:35425)
D1022 10:28:39.705538287   24227 tcp_posix.cc:1062]          DATA: 00 00 04 08 00 00 00 00 00 00 3f 00 01 00 00 08 06 00 00 00 00 00 00 '..........?............'
I1022 10:28:39.705549662   24227 tcp_posix.cc:1058]          WRITE 0x7ffa640011b0 (peer=ipv4:127.0.0.1:35425)
D1022 10:28:39.705561036   24227 tcp_posix.cc:1062]          DATA: 00 00 00 00 00 00 00 '.......'
I1022 10:28:39.705593577   24227 tcp_posix.cc:1096]          write: "No Error"
I1022 10:28:39.705604952   24227 chttp2_transport.cc:2660]   ipv4:127.0.0.1:35425: Start BDP ping err="No Error"
I1022 10:28:39.705616327   24227 timer_generic.cc:467]       TIMER 0x7ffa64003648: CANCEL pending=true
I1022 10:28:39.705627660   24227 bdp_estimator.h:66]         bdp[ipv4:127.0.0.1:35425]:start acc=0 est=65536
I1022 10:28:39.705650451   24227 chttp2_transport.cc:839]    W:0x7ffa64001f00 SERVER [ipv4:127.0.0.1:35425] state WRITING -> IDLE [finish writing]
I1022 10:28:39.705674784   24227 timer_generic.cc:365]       TIMER 0x7ffa64003648: SET 7214812 now 14812 call 0x7ffa640035a8[0x7ffa78aff900]
I1022 10:28:39.705686117   24227 timer_generic.cc:401]         .. add to shard 7 with queue_deadline_cap=15009 => is_first_timer=false
I1022 10:28:39.732094959   24227 tcp_posix.cc:605]           TCP:0x7ffa640011b0 got_read: "No Error"
I1022 10:28:39.732152375   24227 tcp_posix.cc:590]           TCP:0x7ffa640011b0 alloc_slices
I1022 10:28:39.732163750   24227 resource_quota.cc:889]      RQ anonymous_pool_7ffa64000fb0 ipv4:127.0.0.1:35425: alloc 8192; free_pool -> -8192
I1022 10:28:39.732175166   24227 resource_quota.cc:321]      RQ: check allocation for user 0x7ffa640014a0 shutdown=0 free_pool=-8192
I1022 10:28:39.732186499   24227 resource_quota.cc:347]      RQ anonymous_pool_7ffa64000fb0 ipv4:127.0.0.1:35425: grant alloc 8192 bytes; rq_free_pool -> 9223372036854767615
I1022 10:28:39.732197832   24227 tcp_posix.cc:571]           TCP:0x7ffa640011b0 read_allocation_done: "No Error"
I1022 10:28:39.732209207   24227 tcp_posix.cc:401]           TCP:0x7ffa640011b0 call_cb 0x7ffa64002040 0x7ffa78b01360:0x7ffa64001f00
I1022 10:28:39.732222165   24227 tcp_posix.cc:404]           READ 0x7ffa640011b0 (peer=ipv4:127.0.0.1:35425) error="No Error"
D1022 10:28:39.732271497   24227 tcp_posix.cc:410]           DATA: 50 4f 53 54 20 2f 64 69 63 6f 6d 2e 44 69 63 6f 6d 2f 53 61 79 48 65 6c 6c 6f 20 48 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 31 32 37 2e 30 2e 30 2e 31 3a 35 30 30 35 31 0d 0a 55 73 65 72 2d 41 67 65 6e 74 3a 20 67 72 70 63 2d 64 6f 74 6e 65 74 2f 32 2e 32 34 2e 30 2e 30 0d 0a 54 45 3a 20 74 72 61 69 6c 65 72 73 0d 0a 67 72 70 63 2d 61 63 63 65 70 74 2d 65 6e 63 6f 64 69 6e 67 3a 20 69 64 65 6e 74 69 74 79 2c 67 7a 69 70 0d 0a 54 72 61 6e 73 66 65 72 2d 45 6e 63 6f 64 69 6e 67 3a 20 63 68 75 6e 6b 65 64 0d 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 70 70 6c 69 63 61 74 69 6f 6e 2f 67 72 70 63 0d 0a 0d 0a 35 0d 0a 00 00 00 00 0f 0d 0a 46 0d 0a 0a 0d 47 72 65 65 74 65 72 43 6c 69 65 6e 74 0d 0a 'POST /dicom.Dicom/SayHello HTTP/1.1..Host: 127.0.0.1:50051..User-Agent: grpc-dotnet/2.24.0.0..TE: trailers..grpc-accept-encoding: identity,gzip..Transfer-Encoding: chunked..Content-Type: application/grpc....5.........F....GreeterClient..'
I1022 10:28:39.732354288   24227 chttp2_transport.cc:2866]   transport 0x7ffa64001f00 set connectivity_state=4
I1022 10:28:39.732365662   24227 connectivity_state.cc:147]  SET: 0x7ffa640021a8 server_transport: READY --> SHUTDOWN [close_transport]
I1022 10:28:39.732377037   24227 connectivity_state.cc:160]  NOTIFY: 0x7ffa640021a8 server_transport: 0x7ffa640042e0
I1022 10:28:39.732388370   24227 timer_generic.cc:467]       TIMER 0x7ffa64003648: CANCEL pending=true
I1022 10:28:39.732433744   24227 chttp2_transport.cc:1900]   perform_transport_op[t=0x7ffa64001f00]: SET_ACCEPT_STREAM:(nil)((nil),...)
I1022 10:28:39.732467744   24227 tcp_posix.cc:854]           TCP:0x7ffa640011b0 got_error: {"created":"@1571754519.732422411","description":"FD Shutdown","file":"src/core/lib/iomgr/lockfree_event.cc","file_line":194,"referenced_errors":[{"created":"@1571754519.732342913","description":"Failed parsing HTTP/2","file":"src/core/ext/transport/chttp2/transport/chttp2_transport.cc","file_line":2582,"grpc_status":14,"referenced_errors":[{"created":"@1571754519.732294330","description":"Connect string mismatch: expected 'R' (82) got 'O' (79) at byte 1","file":"src/core/ext/transport/chttp2/transport/parsing.cc","file_line":97}]}]}
I1022 10:28:39.732498535   24227 chttp2_transport.cc:2676]   ipv4:127.0.0.1:35425: Complete BDP ping err={"created":"@1571754519.732342913","description":"Failed parsing HTTP/2","file":"src/core/ext/transport/chttp2/transport/chttp2_transport.cc","file_line":2582,"referenced_errors":[{"created":"@1571754519.732294330","description":"Connect string mismatch: expected 'R' (82) got 'O' (79) at byte 1","file":"src/core/ext/transport/chttp2/transport/parsing.cc","file_line":97}]}
I1022 10:28:39.732521285   24227 init.cc:211]                grpc_shutdown(void)
I1022 10:28:39.732532618   24227 resource_quota.cc:547]      RU shutdown 0x7ffa640014a0
I1022 10:28:39.902870280   24226 timer_manager.cc:204]       wait ended: was_timed:1 kicked:0
这是我的.NET3.0项目

使用系统;
使用System.Threading.Tasks;
使用Grpc.Net.Client;
使用Dicom;
命名空间客户端
{
班级计划
{
静态异步任务主(字符串[]args)
{
var channel=GrpcChannel.ForAddress(“http://127.0.0.1:50051");
var客户端=新的Dicom.Dicom.Dicom客户端(通道);
var reply=await client.SayHelloAsync(新HelloRequest{Name=“GreeterClient”});
Console.WriteLine(“问候语:+回复信息”);
}
}
}

Exe
netcoreapp3.0
另外,这是我的原始文件:

syntax = "proto3";

package dicom;

// The greeting service definition.
service Dicom {
  // Sends a greeting
  rpc SayHello (HelloRequest) returns (HelloReply);
  rpc SayHellos (HelloRequest) returns (stream HelloReply);
}

// The request message containing the user's name.
message HelloRequest {
  string name = 1;
}

// The response message containing the greetings
message HelloReply {
  string message = 1;
}
更新:我改为使用原始gRPC团队提供的.NET库,它可以正常工作。下面是新的服务器端日志(来自C++),用于调试该问题


我认为您的问题是在使用
http
时需要设置AppContext标志:

//必须在创建GrpcChannel/HttpClient之前设置此开关。
AppContext.SetSwitch(
“System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport”,true);