-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathProgram.cs
More file actions
41 lines (32 loc) · 1.45 KB
/
Program.cs
File metadata and controls
41 lines (32 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// there is an issue in client code generation where the Security.Mode = None
// override client binding with Transport Security Mode to match service definition
NetTcpBinding binding = new NetTcpBinding();
var endpointAddress = new EndpointAddress("net.tcp://localhost:8089/CalculatorService/netTcp");
CalculatorServiceClient client = new CalculatorServiceClient(binding, endpointAddress);
// Call the Add service operation.
double value1 = 100.00D;
double value2 = 15.99D;
double result = client.Add(value1, value2);
Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);
// Call the Subtract service operation.
value1 = 145.00D;
value2 = 76.54D;
result = client.Subtract(value1, value2);
Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);
// Call the Multiply service operation.
value1 = 9.00D;
value2 = 81.25D;
result = client.Multiply(value1, value2);
Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);
// Call the Divide service operation.
value1 = 22.00D;
value2 = 7.00D;
result = client.Divide(value1, value2);
Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result);
//Closing the client gracefully closes the connection and cleans up resources
client.CloseAsync();
Console.WriteLine();
Console.WriteLine("Press <ENTER> to terminate client.");
Console.ReadLine();