I would like my new CoreWCF SOAP service to generate a single-file WSDL (flat WSDL). Is there any way to do this?
Here is my minimized version of Program.cs:
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.ConfigureKestrel((context, options) =>
{
options.AllowSynchronousIO = true;
options.Listen(System.Net.IPAddress.Any, 5800, listenOptions =>
{
listenOptions.Protocols = Microsoft.AspNetCore.Server.Kestrel.Core.HttpProtocols.Http1AndHttp2;
if (sUrl.Scheme == "https") listenOptions.UseHttps();
});
});
builder.Services.AddServiceModelServices().AddServiceModelMetadata();
builder.Services.AddSingleton<IServiceBehavior,
UseRequestHeadersForMetadataAddressBehavior>();
var app = builder.Build();
var binding = new WSHttpBinding(SecurityMode.Transport);
app.UseServiceModel(builder =>
{
builder.AddService<MyService>()
.AddServiceEndpoint<MyService, IMyService>(binding,"MyService");
});
var serviceMetadataBehavior = app.Services.GetRequiredService<ServiceMetadataBehavior>();
serviceMetadataBehavior.HttpsGetEnabled = true;
app.Run();
CodePudding user response:
Just figured out it is simply present at service url ended by ?singlewsdl
instead of just ?wsdl
.
So the answer is https://localhost:5800/MyService?singlewsdl