WebAPI 503 localhost error (setting HttpSelfHostConfiguration HttpSelfHostConfiguration)

I have a window service using WebAPI self-service. HttpSelfHostConfiguration.HostNameComparisonMode set HostNameComparisonMode.Exact to strongly match the host name.

var config = new HttpSelfHostConfiguration(uri); config.HttpSelfHostConfiguration = System.ServiceModel.HostNameComparisonMode.Exact; this._server = new HttpSelfHostServer(config); _server.OpenAsync().Wait(); 

And URL reservation for the specified URL namespace for the domain.

 netsh http add urlacl url=https://+:443/ user=EVERYONE 

To bind an SSL certificate to a port number.

 netsh http add sslcert ipport=0.0.0.0:443 certhash=xxxxxxxxxxx appid={xxxxxxxxx} 

But the result is an HTTP 503 error. I don't know the status.

+7
c # asp.net-web-api
source share
1 answer

I had a similar problem. The problem in my case was double urlacl for my url.

 netsh http show urlacl ... http://+:80/api http://127.0.0.1:80/api (or any IP) 

Remove all possible urlacl duplicates for your program.

+14
source

All Articles