【发布时间】:2017-03-09 19:00:35
【问题描述】:
HttpListener 中有 Prefixes 字段。您可以添加一些字符串,例如“http://+:8080/”,您的应用程序只需处理对 8080 端口的所有查询。
我有HttpSelfHostServer,它只能使用有效的 Uri 字符串,例如输入HttpSelfHostConfiguration 类。我想在我的HttpSelfHostServer 中获得相同的行为,就像在HttpListener 中一样,前缀如下:
http://*:8080/
等等……
...
var configuration = new HttpSelfHostConfiguration(prefix)
var server = new HttpSelfHostServer(configuration);
...
【问题讨论】:
标签: c# self-hosting httplistener self-host-webapi