Skip to content

Commit 185b6f1

Browse files
committed
update code
1 parent 4db4ec4 commit 185b6f1

File tree

4 files changed

+41
-47
lines changed

4 files changed

+41
-47
lines changed

Basic/Binding/Basic/TransportSecurity/Client/Client.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
<Nullable>enable</Nullable>
88
</PropertyGroup>
99

10+
<ItemGroup>
11+
<Using Include="CoreWcf.Samples.TransportSecurity" />
12+
</ItemGroup>
13+
1014
<ItemGroup>
1115
<PackageReference Include="System.ServiceModel.Http" Version="4.*" />
1216
</ItemGroup>
Lines changed: 35 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,38 @@
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-
namespace CoreWcf.Samples.TransportSecurity
5-
{
6-
//The service contract is defined using Connected Service "WCF Web Service", generated from the service by the dotnet svcutil tool.
7-
8-
//Client implementation code.
9-
class Client
10-
{
11-
static void Main()
12-
{
13-
// Create a client with given client endpoint configuration
14-
CalculatorServiceClient client = new CalculatorServiceClient();
15-
16-
// Call the Add service operation.
17-
double value1 = 100.00D;
18-
double value2 = 15.99D;
19-
double result = client.Add(value1, value2);
20-
Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);
21-
22-
// Call the Subtract service operation.
23-
value1 = 145.00D;
24-
value2 = 76.54D;
25-
result = client.Subtract(value1, value2);
26-
Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);
27-
28-
// Call the Multiply service operation.
29-
value1 = 9.00D;
30-
value2 = 81.25D;
31-
result = client.Multiply(value1, value2);
32-
Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);
33-
34-
// Call the Divide service operation.
35-
value1 = 22.00D;
36-
value2 = 7.00D;
37-
result = client.Divide(value1, value2);
38-
Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result);
39-
40-
//Closing the client gracefully closes the connection and cleans up resources
41-
client.CloseAsync();
42-
43-
Console.WriteLine();
44-
Console.WriteLine("Press <ENTER> to terminate client.");
45-
Console.ReadLine();
46-
}
47-
}
48-
}
4+
//The service contract is defined using Connected Service "WCF Web Service", generated from the service by the dotnet svcutil tool.
5+
6+
//Client implementation code.
7+
CalculatorServiceClient client = new CalculatorServiceClient();
8+
9+
// Call the Add service operation.
10+
double value1 = 100.00D;
11+
double value2 = 15.99D;
12+
double result = client.Add(value1, value2);
13+
Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result);
14+
15+
// Call the Subtract service operation.
16+
value1 = 145.00D;
17+
value2 = 76.54D;
18+
result = client.Subtract(value1, value2);
19+
Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result);
20+
21+
// Call the Multiply service operation.
22+
value1 = 9.00D;
23+
value2 = 81.25D;
24+
result = client.Multiply(value1, value2);
25+
Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result);
26+
27+
// Call the Divide service operation.
28+
value1 = 22.00D;
29+
value2 = 7.00D;
30+
result = client.Divide(value1, value2);
31+
Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result);
32+
33+
//Closing the client gracefully closes the connection and cleans up resources
34+
client.CloseAsync();
35+
36+
Console.WriteLine();
37+
Console.WriteLine("Press <ENTER> to terminate client.");
38+
Console.ReadLine();

Basic/Binding/Basic/TransportSecurity/Service/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// Add the Calculator Service
1616
builder.AddService<CalculatorService>(serviceOptions => { })
1717
// Add BasicHttpBinding endpoint
18-
.AddServiceEndpoint<CalculatorService, ICalculatorService>(new BasicHttpBinding(CoreWCF.Channels.BasicHttpSecurityMode.Transport), "/CalculatorService/basicHttpTransportSecurity");
18+
.AddServiceEndpoint<CalculatorService, ICalculatorService>(new BasicHttpBinding(CoreWCF.Channels.BasicHttpSecurityMode.Transport), "CalculatorService/basicHttpTransportSecurity");
1919

2020
// Configure WSDL to be available
2121
var serviceMetadataBehavior = app.Services.GetRequiredService<ServiceMetadataBehavior>();

Basic/Binding/Basic/TransportSecurity/Service/Service.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Using Include="CoreWCF" />
1212
<Using Include="CoreWCF.Configuration" />
1313
<Using Include="CoreWCF.Description" />
14-
<Using Include="CoreWcf.Samples.TransportSecurity" />
14+
<Using Include="CoreWcf.Samples.TransportSecurity" />
1515
</ItemGroup>
1616

1717
<ItemGroup>

0 commit comments

Comments
 (0)