var builder = WebApplication.CreateBuilder(args);
builder.Logging.AddConsole();
builder.WebHost.ConfigureKestrel((context, options) =>
{
options.AllowSynchronousIO = true;
});
// Add WSDL support
builder.Services.AddServiceModelServices().AddServiceModelMetadata();
builder.Services.AddSingleton<IServiceBehavior, UseRequestHeadersForMetadataAddressBehavior>();
builder.Services.AddOptions();
var app = builder.Build();
// Configure an explicit none credential type for WSHttpBinding as it defaults to Windows which requires extra configuration in ASP.NET
var myWSHttpBinding = new WSHttpBinding(SecurityMode.Transport);
myWSHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
app.UseServiceModel(builder =>
{
builder.AddService<EchoService>((serviceOptions) => { })
.AddService<IntefleCSService>((serviceOptions) => { serviceOptions.DebugBehavior.IncludeExceptionDetailInFaults = true; })
// Add a BasicHttpBinding at a specific endpoint
.AddServiceEndpoint<EchoService, IEchoService>(new BasicHttpBinding(), "/EchoService/")
// Add a WSHttpBinding with Transport Security for TLS
//.AddServiceEndpoint<EchoService, IEchoService>(myWSHttpBinding, "/EchoService/WSHttps")
// Add a BasicHttpBinding at a specific endpoint
.AddServiceEndpoint<IntefleCSService, IIntefleCSService>(new BasicHttpBinding(), "/IntefleCSService/");
// Add a WSHttpBinding with Transport Security for TLS
//.AddServiceEndpoint<IntefleCSService, IIntefleCSService>(myWSHttpBinding, "/IntefleCSService/WSHttps");
});
var serviceMetadataBehavior = app.Services.GetRequiredService<CoreWCF.Description.ServiceMetadataBehavior>();
serviceMetadataBehavior.HttpGetEnabled = true;
app.Run();