WebAPI自主机503错误(HttpSelfHostConfiguration设置HttpSelfHostConfiguration)

Jun*_*hoi 10 c# asp.net-web-api

我有一个使用自托管WebAPI的窗口服务.HttpSelfHostConfiguration.HostNameComparisonMode为主机名强匹配设置HostNameComparisonMode.Exact.

var config = new HttpSelfHostConfiguration(uri);
config.HttpSelfHostConfiguration = System.ServiceModel.HostNameComparisonMode.Exact;
this._server = new HttpSelfHostServer(config);
_server.OpenAsync().Wait();
Run Code Online (Sandbox Code Playgroud)

以及域的指定URL命名空间的URL保留.

netsh http add urlacl url=https://+:443/ user=EVERYONE
Run Code Online (Sandbox Code Playgroud)

将SSL证书绑定到端口号.

netsh http add sslcert ipport=0.0.0.0:443 certhash=xxxxxxxxxxx appid={xxxxxxxxx}
Run Code Online (Sandbox Code Playgroud)

但Result出现HTTP 503错误.我不知道状态.

sup*_*opi 19

我遇到了类似的问题.我的问题是我的URL重复urlacl.

netsh http show urlacl
...
http://+:80/api 
http://127.0.0.1:80/api (or any IP)
Run Code Online (Sandbox Code Playgroud)

删除任何可能的重复urlacl为您的程序.