-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathProgram.cs
More file actions
25 lines (19 loc) · 906 Bytes
/
Program.cs
File metadata and controls
25 lines (19 loc) · 906 Bytes
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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
var builder = WebApplication.CreateBuilder();
//Enable CoreWCF Services, with metadata (WSDL) support
builder.Services.AddServiceModelServices()
.AddServiceModelMetadata()
.AddSingleton<IServiceBehavior, UseRequestHeadersForMetadataAddressBehavior>();
var app = builder.Build();
app.UseServiceModel(builder =>
{
// Add the Calculator Service
builder.AddService<CalculatorService>(serviceOptions => { })
// Add BasicHttpBinding endpoint
.AddServiceEndpoint<CalculatorService, ICalculatorService>(new BasicHttpBinding(), "CalculatorService");
// Configure WSDL to be available
var serviceMetadataBehavior = app.Services.GetRequiredService<ServiceMetadataBehavior>();
serviceMetadataBehavior.HttpGetEnabled = true;
});
app.Run();