C# 使用HttpListener时候异常(此平台不支持此操作:System.PlatformNotSupportedException)
代码:HttpListener listener = new HttpListener();
错误:System.PlatformNotSupportedException: Operation is not supported on this platform In System.Net.HttpListener..ctor()
出先上述原因可能是注册表项下创建以下 DWORD 注册表值:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\没有HTTP服务,
可以cmd输入 sc qc http或者sc qc http 可以查看一下,如果没有http服务就需要手动添加注册表,win+R输入regedit 定位到HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\ 手动拖拽http.reg 重启电脑即可。