【发布时间】:2017-10-12 14:14:25
【问题描述】:
我正在将应用程序从 .NET 4 移植到 .NET Core,但找不到 HttpListener 类的模拟
Error CS0246 The type or namespace name 'HttpListener' could not be found (are you missing a using directive or an assembly reference?)
更新1
private readonly HttpListener _httpListener;
if (!HttpListener.IsSupported)
{
throw new NotSupportedException(
"The Http Server cannot run on this operating system.");
}
_httpListener = new HttpListener();
_httpListener.Prefixes.Add(prefix);
_sessionSettings = settings;
【问题讨论】:
-
github上还有一些简单的库github.com/robertsundstrom/HttpListener
-
突然两者(WebListener 和 github.com/robertsundstrom/HttpListener)都没有某些属性,因为不兼容
标签: c# asp.net-core .net-core visual-studio-2017 asp.net-core-2.0