Owin selfhost: using netsh to add an urlAcl seems to cause 503

本小妞迷上赌 提交于 2021-01-29 03:08:09

问题


I have a owin selfhost of a simple WebApi running as a windows service. After creating/installing certificates to aproach this WebApi through https, I got the certificate working but stayed stuck with a return code of 503.

It seemed not a certificate problem, the browser does not complain anymore and shows a closed lock as intended.

I changed the service account during the certificate installation, so to test if that was the problem I changed the listening address back to http. It worked fine

To make this really clear i had owin listening on both http and https

StartOptions options = new StartOptions();
options.Urls.Add(httpAddress); //port_x
options.Urls.Add(httpsAddress); //port_y
_httpServer = WebApp.Start<HttpHost>(options);

//make test calls
GetDataUsingWebClient(httpAddress) // suceeds, content = json
GetDataUsingWebClient(httpsAddress) // statuscode 503, content = 503 message

The result is consistent, approaching httpsAddress/api/test returns 200 + json but httpsAddress/api/test return 503, content = 503 message

With just one listening address (httpsAddress) the service also returns 503


Update: I did not have an urlacl for the http address, so after adding that

netsh http add urlacl url=http://+:port-nr/ user="NT AUTHORITY\System"

The http address also returned 503! >seems strange to me

The good news is that after deletion of both urlacls it now works, but can anyone explain what happens here?

来源:https://stackoverflow.com/questions/40497970/owin-selfhost-using-netsh-to-add-an-urlacl-seems-to-cause-503

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!