我有以下 ASP.net Core 2.1 SOAP 服务 (SoapCore)
var host = WebHost.CreateDefaultBuilder()
.ConfigureServices(services =>
{
services.Add(new ServiceDescriptor(typeof(IMyInterface), typeof(MyService), ServiceLifetime.Singleton));
services.AddSoapCore();
}).Configure(app =>
{
var binding = new BasicHttpBinding();
app.UseSoapEndpoint<IMyInterface>("", binding);
}).UseHttpSys(opt =>
{
opt.UrlPrefixes.Add("http://+:9002/MyService");
}).Build();
我从 SoapUI 调用它,它有效。
我尝试将其切换到 HTTPS:
var host = WebHost.CreateDefaultBuilder()
.ConfigureServices(services =>
{
services.Add(new ServiceDescriptor(typeof(IMyInterface), typeof(MyService), ServiceLifetime.Singleton));
services.AddSoapCore();
}).Configure(app =>
{
var binding = new BasicHttpsBinding();
app.UseSoapEndpoint<IMyInterface>("", binding);
}).UseHttpSys(opt =>
{
opt.UrlPrefixes.Add("https://+:9002/MyService");
}).Build();
它不起作用。我究竟做错了什么?还尝试将服务名称从 UrlPrefix 移动到 Soap 端点,结果相同。Wireshark 显示连接已终止,但未将任何字节发送回客户端。
它在不使用 HTTP.sys 时工作。这有效:
var host = WebHost.CreateDefaultBuilder()
.ConfigureServices(services =>
{
services.Add(new ServiceDescriptor(typeof(IMyInterface), typeof(MyService), ServiceLifetime.Singleton));
services.AddSoapCore();
}).Configure(app =>
{
var binding = new BasicHttpsBinding();
app.UseSoapEndpoint<IMyInterface>("/MyService", binding);
}).UseUrls("https://+:9002").Build();
我需要 HTTP.sys,因为我在同一个端口上有多个服务。我以管理员身份运行服务(用于测试)