File tree Expand file tree Collapse file tree
Basic/Binding/Net/Tcp/Default Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// Licensed to the .NET Foundation under one or more agreements.
22// The .NET Foundation licenses this file to you under the MIT license.
33
4- CalculatorServiceClient client = new CalculatorServiceClient ( ) ;
4+ using System . ServiceModel ;
5+
6+ // there is an issue in client code generation where the Security.Mode = None
7+ // override client binding with Transport Security Mode to match service definition
8+ NetTcpBinding binding = new NetTcpBinding ( ) ;
9+ var endpointAddress = new EndpointAddress ( "net.tcp://localhost:8089/CalculatorService/netTcp" ) ;
10+
11+ CalculatorServiceClient client = new CalculatorServiceClient ( binding , endpointAddress ) ;
512
613// Call the Add service operation.
714double value1 = 100.00D ;
3239
3340Console . WriteLine ( ) ;
3441Console . WriteLine ( "Press <ENTER> to terminate client." ) ;
35- Console . ReadLine ( ) ;
42+ Console . ReadLine ( ) ;
Original file line number Diff line number Diff line change 3030 serviceOptions . BaseAddresses . Add ( new Uri ( $ "http://localhost:{ HttpPort } /CalculatorService/netTcp") ) ;
3131 } )
3232 // Add NetTcpBinding endpoint
33- . AddServiceEndpoint < CalculatorService , ICalculatorService > ( new NetTcpBinding ( SecurityMode . None ) , $ "net.tcp://localhost:{ NetTcpPort } /CalculatorService/netTcp") ;
33+ . AddServiceEndpoint < CalculatorService , ICalculatorService > ( new NetTcpBinding ( ) , $ "net.tcp://localhost:{ NetTcpPort } /CalculatorService/netTcp") ;
3434
3535 // Configure WSDL to be available
3636 var serviceMetadataBehavior = app . Services . GetRequiredService < ServiceMetadataBehavior > ( ) ;
You can’t perform that action at this time.
0 commit comments