.NET Core中HttpListener的模拟是什么

编程入门 行业动态 更新时间:2024-10-23 18:21:07
本文介绍了.NET Core中HttpListener的模拟是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在将应用程序从.NET 4移植到.NET Core,找不到HttpListener类的模拟

I'm porting application from .NET 4 to .NET Core and can't find analog for HttpListener class

Error CS0246 The type or namespace name 'HttpListener' could not be found (are you missing a using directive or an assembly reference?)

Update1

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;

推荐答案

在.NET Core 2.0中,我们没有问题(感谢Martin Ullrich),所以现在我们需要安装 Visual Studio Preview 2017 15.3版可以使用.NET Core 2.0。

In .NET Core 2.0 we don't have that problem ( thanks Martin Ullrich), so now we need install Visual Studio Preview 2017 version 15.3 where we can use .NET Core 2.0.

但是默认情况下(目前最低),没有.NET Core 2.0,我们需要在VS 2017安装后安装。

But by default (as minimum for now) there don't have .NET Core 2.0 and we need install it after VS 2017 installation.

PS:-再次感谢Martin Ullrich-太神奇了,只有5月10日(在我问之前3天).NET Core 2.0 正在宣布-现在我知道了

P.S: - thanks again Martin Ullrich - it's amazing, only 10 May ( 3 days before I have asking) .NET Core 2.0 was announcing - and I have it now

更多推荐

.NET Core中HttpListener的模拟是什么

本文发布于:2023-11-16 11:19:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1603807.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:NET   Core   HttpListener

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!